Category Facet drill down based on product results


I integrated Magento 2 algolia extension and enabled Instant Search for category pages. I understand that the category facet is an hierarchicalMenu type and when we load any category page, Category facet shows all other categories.

But our requirement is to show only those categories which are the resulted products are assigned to.

For e.g, as shown in the above screenshot, category New has 16 results and some of these products are also assigned to other Categories like (DJ, Lighting etc.)
In this scenario, we need to show only those categories DJ, Lighting etc along with New, but not all other categories like Accessories (as shown in screenshot).
Also the product count for all these categories in facet should not greater than 16, as total number of products in the current category New is 16 only.

I tried by adding following parameter to category facet configuration, but it results only the subcategory of New in the facet results.
rootPath: algoliaConfig.request.path

Please let me know how to achieve this ?

Hello @rajendrak,

interesting use-case. How it should work when you select another category? Should it join the condition with AND? So it will be 'New' AND 'DJ' for example?

In the above screen sheet, New has 16 products, if 8 products out of these 16 are also assigned to DJ (in addition to New), then the count for DJ should show 8 (not 45 as in screen shot).

Now, If we choose DJ, total products in results should be 8 and list of all categories assigned to these 8 products should display in categories facet.

Sorry, if I made you confuse.

Thank you for specifying that. Unfortunately it’s not possible to do it with hierarchical menu widget :pensive:

It’s doable only with refinement list, but it doesn’t support hierarchical structure. Sorry about that.