This feature requires a specific UI implementation that relies on the latest version of InstantSearch,
or with some custom logic built-in.
Merchandise facets in the Visual Editor
Consider the earlier example, where an ecommerce platform sells clothes and tech products. First, you need to set a default facet display so that if a user lands on anything but tech products, they see the facets “brand”, “size”, and “color”. With the default order set, you need to set a rule to override this default order for the tech products category.- Select Rules in the Algolia dashboard.
- Select Create your first rule or New rule and select Visual Editor.
-
To set the condition, check whether you have category pages configured on your Visual Editor.
You would follow separate steps, depending on whether it’s configured or not:
If category pages are configured on your Visual Editor:
- Click Choose category page.
- Select “Tech Products”.
- Click Apply.
- Click Set query condition.
- Toggle on Filters and toggle off Query,
- In the Filter name field, enter
Brand
. In the Filter value field, enterTech Products
, - Click Apply.
-
In the Consequences section:
- Click the Order facets button.
- Import the default order defined for your facet display by selecting Import default order.
- Click the trash icon next to the facets “size” and “color” so they’re not displayed anymore in this category.
- Click the Add facets button and select “screen type” and “screen size” to add them to the list of facets to display.
- Use the
=
icon to reorder the facets by dragging and dropping them. The order in the UI is the same as the order in the dashboard.
- Review and publish your changes.
Merchandise facet values in the Visual Editor
Selecting which facets to display and in which order is one aspect of facet merchandising. The other aspect is about facets values. By default, the values within each facet are ordered by count: the values with the highest number of matching results appear at the top. You can tweak this order in several ways:- You can pin some values to the top of the list. For example, you might have a partnership with a specific brand that you always want to display at the top of the list.
- The non-pinned values can then be ordered by count, alphabetically, or hidden so that only pinned values are displayed.
- To pin the brand “Sony” at the top of the list of brands
- Have the other brands ordered alphabetically
- Have the “screen type” values ordered by count
- Only display the three most common values for “screen size”: 32, 55, and 65 inches.
- Select Rules in the Algolia dashboard.
- Under the Rules header, select the index to which you’re adding a rule.
- Identify the rule created in the earlier example, click the three dots (ellipsis), and select the option “Edit this Rule”.
- In the strategy section, click the pen icon to edit the facet display strategy.
-
To set the strategy for the “brand” facet:
- Click the pen icon to edit the “brand” facet.
- Click “pin facet value” and select the brand “Sony” to pin it to the top of the list.
- To order subsequent values, in the drop-down menu, click “alphabetically”.
- For the “screen type” facet, the order should already be by count, so you should have nothing to change here.
-
To set the strategy for the “screen size” facet:
- Click the pen icon to edit the “screen size” facet.
- Click “pin facet value” and select the values 32in, 55in, 65in to pin them at the top of the list.
- Use the
=
icon to drag the values into the correct order. - To order subsequent values, in the drop-down menu, select “do not display” to ensure that only the three selected values are displayed.
- Review and publish your changes.
Merchandise facets and their values in the Manual Editor
Merchandising facets and their values is also possible using the Manual Editor but requires an understanding of the settingrenderingContent
.
- Select Rules in the Algolia dashboard.
- Under the Rules header, select the index you are adding a Rule to.
- Select Create your first rule or New rule. In the drop-down menu, select the Manual Editor option.
- In the Condition(s) section, toggle Filters on. Select “screen type” in the attribute name field, and “tech products” in the attribute value field.
- Still in the Condition(s) section, toggle Query off.
-
In the Consequence(s) section:
- Click the Add consequence button and select Add query parameter.
- In the input field, enter the JSON to customize the
renderingContent
parameter. For example, to match the same example as described for the Visual Editor, the JSON would look like this:
JSON
- Save your changes.