🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
API Reference / API Parameters / renderingContent
Type: Object
Engine default:
Parameter syntax
'renderingContent' => array

Can be used in these methods:

About this parameter

Defines how you want to render results in the search interface.

You can set a default with setSettings and override it with Rules.

  • facetOrdering. Controls the order of facets in your UI.
  • values. Controls the order of specific facet values.
  • sortRemainingBy. Determines how to sort remaining values if a facet value isn’t specified. It can be one of:
    • alpha sorts by facet value, alphabetically in ascending order
    • count sorts by facet value count, numerically in descending order
    • hidden hides facet values that aren’t included in the values list.

Usage notes

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

Examples

Set renderingContent

The following example snippet uses renderingContent to define how results are displayed:

  • brand ordering starts with “uniqlo” and all other facet values, such as “timberland”, are sorted by facet value count.
  • The size ordering sequence is “S”, “M”, and “L” and other facet values, such as “XS”, are hidden.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$index->setSettings([
  'renderingContent' => [
    'facetOrdering' => [
      'facets' => [
        'order' => ['size', 'brand']
      ],
      'values' => [
        'brand'=> [
          'order' => ['uniqlo'],
          'sortRemainingBy' => 'count'
        ],
        'size'=> [
          'order' => ['S', 'M', 'L'],
          'sortRemainingBy' => 'hidden'
        ],
      ]
    ]
  ]
]);
Did you find this page helpful?