I have categories like:
auto, tools & travel
auto, tools & travel > luggage tags
auto, tools & travel > luggage tags > luggage spotters
auto, tools & travel > luggage tags > something else
auto, tools & travel > car organizers
Products are assigned to end level subcategory. e.g. "auto, tools & travel > luggage tags > luggage spotters", but not to an upper level category/subcategory.
I want to get products that are under all subcategories when searched by a category. e.g. when searched by "categories:auto, tools & travel" I want to get all the products which are under the categories/subcategories listed above. I use a wildcard search for it and it works.
So, "categories:Auto,\ Tools\ &\ Travel\ >*" brings all the products with the mentioned categories. You may suggest a better way for this task.
The next problem is when I use "categories" as "facet.field:categories" I get count of each subcategory. e.g. "auto, tools & travel > luggage tags > luggage spotters" (50), and "auto, tools & travel > luggage tags > something else" (40) but "auto, tools & travel > luggage tags" is zero since no product is directly assigned to this category and same for "auto, tools & travel". I want to get product count for "auto, tools & travel > luggage tags" and "auto, tools & travel". Assuming "auto, tools & travel > car organizers" (25), I should get 90 for "auto, tools & travel > luggage tags" and 115 for "auto, tools & travel".
Expected facet count:
auto, tools & travel (115)
auto, tools & travel > luggage tags (90)
auto, tools & travel > luggage tags > luggage spotters (40)
auto, tools & travel > luggage tags > something else (50)
auto, tools & travel > car organizers (25)
Categories field is a multi-valued field. A sample product entry is as follow:
{
"cat_aliases":["travel-agency",
"luggage-tags"],
"prd_id":85579,
"prd_name":"Suitcase Shaped PVC Luggage Tag",
"categories":["Industry Promotional Products > Travel Agency",
"Auto, Tools & Travel > Luggage Tags"],
"item_color":["yellow",
"black",
"blue",
"red"],
"prd_sort_order":24,
"id":"7a4c1eba-95ec-4d62-9b15-7dfac1cb10ec",
"_version_":1595462736827908098
}