You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Hierarchical menu references](https://www.algolia.com/doc/api-reference/widgets/hierarchical-menu/js/)
612
612
613
-
The `hierarchicalMenu` widget is used to create a navigation based on a hierarchy of facet attributes. It is commonly used for categories with subcategories.
613
+
The `hierarchicalMenu` widget is used to create a navigation based on a hierarchy of facet attributes. It is commonly used for categories with subcategories. See [usage](#hierarchical-menu-usage) bellow.
614
614
615
-
No compatibility because Meilisearch does not support hierarchical facets.
615
+
- ✅ container: The CSS Selector or HTMLElement to insert the refinements. _required_
616
+
- ✅ attribute: The name of the attributes to generate the menu with. _required_.
617
+
- ✅ limit: How many facet values to retrieves.
618
+
- ✅ showMore: Whether to display a button that expands the number of items.
619
+
- ✅ showMoreLimit: The maximum number of displayed items (min `2`).
620
+
- ❌ separator: The level separator used in the records. (default `>`).
621
+
- 🤷♀️ rootPath: The prefix path to use if the first level is not the root level.
622
+
- ❌ showParentLevel: Whether to show the siblings of the selected parent level of the current refined value.
623
+
- ✅ sortBy: How to sort refinements. [See guide](https://www.algolia.com/doc/api-reference/widgets/hierarchical-menu/js/#widget-param-sortby)
624
+
- ✅ templates: The templates to use for the widget.- ✅ templates: The templates to use for the widget.
625
+
- ✅ cssClasses: The CSS classes to override.
626
+
627
+
#### Hierarchical Menu Usage
628
+
To make it work with Meilisearch your documents must have a specific structure, explaination on the structure can [be found here](https://www.algolia.com/doc/api-reference/widgets/hierarchical-menu/js/#requirements).
629
+
630
+
Contrary to `instantsearch.js`, the hierchical fields are added in [`filterableAttributes`](https://docs.meilisearch.com/reference/api/filterable_attributes.html#update-filterable-attributes).
631
+
632
+
Example:
633
+
Give the following document structure:
634
+
```json
635
+
{
636
+
"id": 1,
637
+
"name": "Basic T-shirt",
638
+
"categories.lvl0": "Men",
639
+
"categories.lvl1": "Men > clothes",
640
+
"categories.lvl2": "Men > clothes > t-shirt"
641
+
}
642
+
```
643
+
644
+
You have to add the fields `categories.lvl0`, `categories.lvl1` and `categories.lvl2` in the `filterableAttributes` in your Meilisearch settings.
645
+
```json
646
+
{
647
+
"filterableAttributes": [
648
+
"categories.lvl0",
649
+
"categories.lvl1",
650
+
"categories.lvl2"
651
+
]
652
+
}
653
+
```
616
654
617
-
If you'd like get nested facets/hierarchical facets implemented, please vote for it in the [roadmap](https://roadmap.meilisearch.com/c/97-nested-facets?utm_medium=social&utm_source=portal_share).
618
655
619
656
### ✅ RangeSlider
620
657
@@ -819,15 +856,19 @@ The `hitsPerPage` widget displays a dropdown menu to let the user change the num
819
856
- ✅ cssClasses: The CSS classes to override.
820
857
- ✅ transformItems: function receiving the items, called before displaying them.
The `breadcrumb` widget is a secondary navigation scheme that lets the user see where the current page is in relation to the facet’s hierarchy.
863
+
The `breadcrumb` widget is a secondary navigation scheme that lets the user see where the current page is in relation to the facet’s hierarchy. The `HierarchicalMenu` widget has the same requirements, see its [usage](#hierarchical-menu-usage) to make breadcrumb work.
827
864
828
-
No compatibility because Meilisearch does not support hierarchical facets.
865
+
- ✅ container: The CSS Selector or HTMLElement to insert the refinements. _required_
866
+
- ✅ attribute: The name of the attributes to generate the menu with. _required_.
867
+
- ❌ separator: The level separator used in the records. (default `>`).
868
+
- 🤷♀️ rootPath: The prefix path to use if the first level is not the root level.
869
+
- ✅ templates: The templates to use for the widget.- ✅ templates: The templates to use for the widget.
870
+
- ✅ cssClasses: The CSS classes to override.
829
871
830
-
If you'd like get nested facets implemented, please vote for it in the [roadmap](https://roadmap.meilisearch.com/c/97-nested-facets?utm_medium=social&utm_source=portal_share).
0 commit comments