Why is it recommended to model hierarchical categories as separate facets? #4417
Unanswered
richardscarrott
asked this question in
General
Replies: 1 comment 1 reply
-
Hey @richardscarrott! I didn't find original resources and context about this design decision besides the original implementation, which doesn't explain the reasoning. We'll come back to you with a detailed answer next week 🙂 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The
HierarchicalMenu
widget and documentation recommends modelling each level as a separate facet, e.g.Given this hierarchy:
You'd model it like this:
And then defining a separate facet for each level, i.e.
categories.lvl0
,categories.lvl1
andcategories.lvl2
.My understanding is, when a user drills down to 'Clothing > T-Shirts', the
HierarchicalMenu
widget does something like:The UI then takes all these facets and string splits as appropriate to render the
HierarchicalMenu
as desired.I'm struggling to see why it couldn't be simplified by modelling it like this:
And defining just one facet on
categories
.That way, again if a user was to drill down to 'Clothing > T-Shirts', the search would just need to perform the following:
(This I think is the same pattern as regular non-hierarchical facets).
Then a UI could take the category facets returned, determine the level by string splitting (
'Shoes > Running Shoes'.split(' > ').length
), filter out those which aren't in a level above or within the 'Clothing' category and render them in a hierarchical menu.Having written this question out, I now see a potential drawback is you'd be over fetching facet values because you'd return 'Shoes > Running Shoes' for example which wouldn't be rendered in the above scenario of ('Clothing > T-Shirts') and you'd therefore be sharing the
maxValuesPerFacet
of 1000 across all levels but, at least in our scenario, we're way off 1000 categories (we have ~60).It'd be great if you could help me determine if my second approach is in fact viable (totally possible it wouldn't even work correctly as I've not implemented it yet) and also if you could share some of the decisions / tradeoffs you made when designing the
HierarchicalMenu
.Beta Was this translation helpful? Give feedback.
All reactions