Dynamic Facets - Algolia

How dynamic facets work

Dynamic Facets uses query aggregation data to reorder facets and facet values based on filtering patterns in past searches. Dynamic Facets:

Get started

To use Dynamic Facets in your UI, read facet and facet value ordering from the renderingContent.facetOrdering property in the search response. You can use this ordering with InstantSearch or in a custom UI.

With InstantSearch

Use the DynamicWidgets component to render refinement lists in the order returned by Dynamic Facets.

To apply facet value ordering automatically from the search response, you need InstantSearch.js 4.72.0 or later or React InstantSearch v6 or later.

With a custom UI

To use Dynamic Facets without InstantSearch:

  1. Read the facet ordering from the renderingContent.facetOrdering property in the search response.
  2. Combine it with the facets property to build the final facet order in your UI.
  3. Render only facets that are present in the response so you don’t show outdated attributes.

For example:

JSON

{
  "renderingContent": {
    "facetOrdering": {
      "facets": {
        "order": ["brand", "categories", "color"]
      },
      "values": {
        "brand": {
          "order": ["Nike", "Adidas", "Puma"],
          "sortRemainingBy": "count"
        },
        "categories": {
          "order": ["Shoes", "Jacket", "Jogging"],
          "sortRemainingBy": "count"
        },
        "color": {
          "order": ["Red", "Green", "Blue"],
          "sortRemainingBy": "count"
        }
      }
    }
  }
}

Settings

Use these settings to configure how Dynamic Facets orders facets and facet values.

Coverage

You can use another index as the source of events. For example, if a replica doesn’t receive events, you can reorder its facets and facet values based on events from its primary index.

Browsing facets

If you use Algolia for navigation, you can select a browsing facet for empty queries. This means that instead of reordering facets based on a specific query, Dynamic Facets can reorder them for a single filter used for browsing, such as categories:"Shoes".

Where to apply

Choose where Dynamic Facets applies. You can A/B test these options independently.

Pinned facets

Pin up to 10 facets to keep them at the top of the list. Dynamic Facets orders all other facets automatically. Use pinned facets for globally relevant facets that should always stay visible, for example, for commercial or policy reasons.

Preserve value order for selected facets

Use this option for facets such as size or date, where facet values follow a logical order. The facet can still move within the list, but its values keep the order inherited from Facet display.

Interaction with Facet display index setting

If your index has facets listed in the Facet display index setting, Dynamic Facets merges its output with that setting at search time instead of replacing it.

Facet ordering

Facet display acts as a list of allowed facets. Dynamic Facets reorders only facets listed there. If Dynamic Facets generates a facet that isn’t in the index setting, that facet is removed. Facets present in the index setting but not in the Dynamic Facets output are appended at the end in the same order as the index setting. This guarantees that:

If no facets are listed in the Facet display index setting, the Dynamic Facets output is used as-is.

Facet value ordering

For each facet in the final list:

Interaction with other features

Limitations