Implement a hierarchical facet strategy
Hierarchical facets let you combine filters in a search, and resolve the problem of an increased number of facet values. To improve system performance and efficiency, implement a hierarchical facet strategy to help your customers navigate your content collection.
To implement hierarchical facets:
-
In your list of facets, identify any facets that, when combined, yield items that can be classified under others. For example, brand and model.
-
Create a new facet named by concatenating the names of the facets identified in step 1. For example, brand_model, a concatenated string of brand and model with a _ as delimiter.
-
Add the new facet as an attribute to the entity and then configure this attribute for use as a facet.
-
Update the source's extractor logic to set a concatenated string of the facet values. For example, of brand and model, separated by a
_.For example, Ford_Focus and Ford_Kuga.
-
Publish the updated source and trigger a reindex.
-
After the application or page loads, do the following:
-
Request data for your widget for all facets and values. In this example, that is widget
rfkid_7,Remember to run this request at least once per session.
-
On response, locally store the returned facet objects.
-
Using the data in the lists of facets and facet values, build the required user interface.
-
-
Using the following code block as a reference, update your data request for widget
rfkid_7. -
From that request, using the response for the widget, parse the items of
contentto determine the count of individual facets. For example, by using thebrand_modelfield, countbrandandmodelin a response with the following facets:In this example, the index has 8 Ford cars, comprised of 6 Focus and 2 Kuga.
-
Populate the list of facets created in step 6. For example: