Skip to main content
The renderingContent parameter defines how your search results and facets are ordered in the user interface. This configuration is primarily used by InstantSearch to control widget behavior, display banners, and sort or hide facets. You can set a default using setSettings and override it dynamically with Rules.

Usage

Properties

facetOrdering
object
Controls how facets and their values are ordered in the UI.
redirect
object
widgets
object
Custom widget configuration returned from active rules.

Usage

InstantSearch uses this property to define the UI through configuration—for example, with the dynamicWidgets widget. If you’re not using InstantSearch for your frontend, you can build a UI with renderingContent

Example

The following example snippet uses renderingContent to define how results are displayed:
  • In dynamic widgets, size is always shown before brand.
  • For the brand facet: the facet value uniqlo is always shown first, muji is never shown, and other facet values are sorted by decreasing facet count.
  • For the size facet: only the values S, M, and L are shown and other facet values are hidden.

Current API clients

var settings = new IndexSettings
{
  RenderingContent = new RenderingContent
  {
    FacetOrdering = new FacetOrdering
    {
      Facets = new FacetsOrder
      {
        Order = new List { "size", "brand" }
      },
      Values = new Dictionary
      {
        {
          "brand",
          new FacetValuesOrder
          {
            Order = new List { "uniqlo" },
            Hide = new List { "muji" },
            SortRemainingBy = "count"
          }
        },
        {
          "size",
          new FacetValuesOrder
          {
            Order = new List { "S", "M", "L" },
            SortRemainingBy = "hidden"
          }
        }
      }
    }
  }
};

index.SetSettings(settings);

// Asynchronous
await index.SetSettingsAsync(settings);
var settings = new IndexSettings
{
  RenderingContent = new RenderingContent
  {
    FacetOrdering = new FacetOrdering
    {
      Facets = new FacetsOrder
      {
        Order = new List { "size", "brand" }
      },
      Values = new Dictionary
      {
        {
          "brand",
          new FacetValuesOrder
          {
            Order = new List { "uniqlo" },
            Hide = new List { "muji" },
            SortRemainingBy = "count"
          }
        },
        {
          "size",
          new FacetValuesOrder
          {
            Order = new List { "S", "M", "L" },
            SortRemainingBy = "hidden"
          }
        }
      }
    }
  }
};

index.SetSettings(settings);

// Asynchronous
await index.SetSettingsAsync(settings);
I