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 and visibility of specific facet values with order and hide properties.
    • 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.
  • widgets. Controls the configuration of specific InstantSearch widgets in your UI. You can’t set this property with the setSettings method. Use Rules instead.
    • banners. Determines how InstantSearch may display any banner configured by Rules. If this property is populated, the Hits widget displays a banner by default.

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”, never shows the value “muji”, 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
20
$index->setSettings([
  'renderingContent' => [
    'facetOrdering' => [
      'facets' => [
        'order' => ['size', 'brand']
      ],
      'values' => [
        'brand'=> [
          'order' => ['uniqlo'],
          'hide' => ['muji'],
          'sortRemainingBy' => 'count'
        ],
        'size'=> [
          'order' => ['S', 'M', 'L'],
          'sortRemainingBy' => 'hidden'
        ],
      ]
    ]
  ]
]);
Did you find this page helpful?