Skip to content

Commit 8280f0b

Browse files
committed
Add compatibility with hierarchicalMenu and breadcrumb in readme
1 parent 3a95896 commit 8280f0b

File tree

1 file changed

+59
-18
lines changed

1 file changed

+59
-18
lines changed

README.md

Lines changed: 59 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ List of all the components that are available in [instantSearch](https://github.
195195
### Table Of Widgets
196196

197197
-[InstantSearch](#-instantsearch)
198-
-[index](#-index)
198+
- [index](#-index)
199199
-[SearchBox](#-searchbox)
200200
-[Configure](#-configure)
201-
-[ConfigureRelatedItems](#-configure-related-items)
202-
-[Autocomplete](#-autocomplete)
201+
- [ConfigureRelatedItems](#-configure-related-items)
202+
- [Autocomplete](#-autocomplete)
203203
-[Voice Search](#-voice-search)
204204
-[Insight](#-insight)
205205
-[Middleware](#-middleware)
@@ -209,9 +209,9 @@ List of all the components that are available in [instantSearch](https://github.
209209
-[Highlight](#-highlight)
210210
-[Snippet](#-snippet)
211211
-[Geo Search](#-geo-search)
212-
-[Answers](#-answers)
212+
- [Answers](#-answers)
213213
-[RefinementList](#-refinementlist)
214-
- [HierarchicalMenu](#-hierarchicalmenu)
214+
- [HierarchicalMenu](#-hierarchicalmenu)
215215
-[RangeSlider](#-rangeslider)
216216
-[Menu](#-menu)
217217
-[currentRefinements](#-currentrefinements)
@@ -223,13 +223,13 @@ List of all the components that are available in [instantSearch](https://github.
223223
-[ClearRefinements](#-clearrefinements)
224224
-[Pagination](#-pagination)
225225
-[HitsPerPage](#-hitsperpage)
226-
- [Breadcrumb](#-breadcrumb)
226+
- [Breadcrumb](#-breadcrumb)
227227
-[Stats](#-stats)
228-
-[Analytics](#-analytics)
229-
-[QueryRuleCustomData](#-queryrulecustomdata)
230-
-[QueryRuleContext](#-queryrulecontext)
228+
- [Analytics](#-analytics)
229+
- [QueryRuleCustomData](#-queryrulecustomdata)
230+
- [QueryRuleContext](#-queryrulecontext)
231231
-[SortBy](#-sortby)
232-
-[RelevantSort](#-relevantsort)
232+
- [RelevantSort](#-relevantsort)
233233
-[Routing](#-routing)
234234

235235

@@ -606,15 +606,52 @@ instantsearch.widgets.refinementList({
606606
})
607607
```
608608

609-
### HierarchicalMenu
609+
### HierarchicalMenu
610610

611611
[Hierarchical menu references](https://www.algolia.com/doc/api-reference/widgets/hierarchical-menu/js/)
612612

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.
614614

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+
```
616654

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).
618655

619656
### ✅ RangeSlider
620657

@@ -819,15 +856,19 @@ The `hitsPerPage` widget displays a dropdown menu to let the user change the num
819856
- ✅ cssClasses: The CSS classes to override.
820857
- ✅ transformItems: function receiving the items, called before displaying them.
821858

822-
### Breadcrumb
859+
### Breadcrumb
823860

824861
[Breadcrumb references](https://www.algolia.com/doc/api-reference/widgets/breadcrumb/js/)
825862

826-
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.
827864

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.
829871

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).
831872

832873
### ✅ Stats
833874

0 commit comments

Comments
 (0)