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
682: Add compatibility with hierarchicalMenu/breadcrumb/RatingsMenu in readme r=bidoubiwa a=bidoubiwa
Per `@gmourier` tests, these widgets are compatible provided that you meet the requirements.
For example the document structure and the settings.
Co-authored-by: Charlotte Vermandel <[email protected]>
Co-authored-by: cvermand <[email protected]>
[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 navigation based on a hierarchy of facet attributes. It is commonly used for categories with subcategories. See [usage](#hierarchical-menu-usage) below.
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 retrieve.
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, an explanation of 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 hierarchical 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
@@ -761,13 +798,19 @@ The `numericMenu` widget displays a list of numeric filters in a list. Those num
761
798
- ✅ cssClasses: The CSS classes to override.
762
799
- ✅ transformItems: function receiving the items, called before displaying them.
763
800
764
-
### ❌ RatingMenu
801
+
### ✅ RatingMenu
765
802
766
803
[Rating menu references](https://www.algolia.com/doc/api-reference/widgets/rating-menu/js/)
767
804
768
805
The `RatingMenu` widget lets the user refine search results by clicking on stars. The stars are based on the selected attribute.
769
806
770
-
No compatibility because Meilisearch does not support integers as facet and instantSearch uses facets information to showcase the UI elements.
807
+
- ✅ container: The CSS Selector or HTMLElement to insert the widget into. _required_
808
+
- ✅ attribute: The name of the attribute in the document. _required_.
809
+
- ✅ max: The maximum value for the rating. This value is exclusive, which means the number of stars will be the provided value, minus one.
810
+
- ✅ templates: The templates to use for the widget.
811
+
- ✅ cssClasses: The CSS classes to override.
812
+
813
+
Contrary to `instantsearch.js`, To be able to use `RatingMenu` the field containing the rating has to be added in the [`filterableAttributes`](https://docs.meilisearch.com/reference/api/filterable_attributes.html#update-filterable-attributes) setting in your index settings.
771
814
772
815
### ✅ ClearRefinements
773
816
@@ -819,15 +862,19 @@ The `hitsPerPage` widget displays a dropdown menu to let the user change the num
819
862
- ✅ cssClasses: The CSS classes to override.
820
863
- ✅ 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.
869
+
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
870
828
-
No compatibility because Meilisearch does not support hierarchical facets.
871
+
- ✅ container: The CSS Selector or HTMLElement to insert the refinements. _required_
872
+
- ✅ attribute: The name of the attributes to generate the menu with. _required_.
873
+
- ❌ separator: The level separator used in the records. (default `>`).
874
+
- 🤷♀️ rootPath: The prefix path to use if the first level is not the root level.
875
+
- ✅ templates: The templates to use for the widget.- ✅ templates: The templates to use for the widget.
876
+
- ✅ cssClasses: The CSS classes to override.
829
877
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