The Value Filter facet is used to create a navigation based on options available in one field. Allows the user to drill down to content by selecting one or more filters
The objects to use in the hierarchical menu must follow this structure:
category being an Elasticsearch field mapping type of
|field||Aggregation field to be used, a field that is type |
|identifier||Required to be unique. Used to apply filters on field|
|label||UI label for facet. Returned in API|
|display||Optional. Used on UI to specify what component to handle facet. Returned in API|
You can use GraphQL summary node to provide you what filters have been applied and the search query. list below is all possible values that summary node provides and with graphQL, you can specify what fields you need.
- Notice how the filters are applied with the level property added.
- Within facets, entries can return sub entries for hierarchical facets when they are selected. The GQL example supports up to 3 levels but you can add more sub levels, depending on how many sub category fields you have
If you use the FacetList component, the component should work out the box.
FilterLinkReact component. This will provide both href url (if routing has been switched on) / onClick handler to remove the filter. See FilterLink API documentation for more information.