Facets

Facets are a kind of filter which allows customers to refine a product list based on values in the index (Figure 1.1).

Figure 1.1 Frontend example of how facets work

Technically, a facet is a mapping between a query parameter (e.g. Manufacturer) and a list of values from a field in the index (e.g. Manufacturer name) – selecting one of the values then passes the value to the query, and the filtered query result is then returned to frontend.

Facets are created inside facet groups - to create a facet group:

  • Click Add Facets in the repository toolbar to create a facet group
  • Name it
  • Select a Query to pass the facet values to

This opens the facet group configuration view (Figure 1.2).

Figure 1.2 Creating a facet group

From the facet group view you can add three types of facet:

  • A field facet retrieves a list of all possible values found in a particular field in the index
  • A list facet lets you group field values under a common label (“Spring colors”)
  • A term facet is identical to a field facet, but will only retrieve the 2048 most frequently used field options from a field. In general, we don’t recommend faceting on data which requires you to use a term facet, as too many facet options can impact performance.

All three types can calculate the number of matching elements in the query result for each facet option. Facets in a facet group can be sorted via drag & drop.

To show facets in frontend select then on the product catalog app used to publish the index query. By default, all facets are shown in frontend but you can control this with either cascading facets (see below) or directly on each product group.

Field facets retrieve facet options from a particular field in the index – so if the field Colors has twelve different values (blue, green, red, mauve, etc.), twelve different facet options will be available in frontend.

To create a field facet:

  • Click Add field facet on the facet group page
  • Provide a facet name
  • Select a field to retrieve facet options from (fields with more than 2048 different terms cannot be selected - use a term facet instead)
  • Select a query parameter to pass the option values to
  • (optional) Specify a render type

The Show section allows you to specify when the facet should be shown in frontend - Always or Conditionally, based on another facet/parameter having a value, specific or not.

Figure 2.1 Creating field facets

A list facet allows you to manually specify list options and give them custom labels (Figure 3.1).

  • Click Add list facet on the facet group page
  • Provide a facet name
  • Select a field to retrieve facet options from
  • Select a query parameter to pass the option values to
  • (Optional)Specify a render type
  • Create a number of labels and values

The Show section allows you to specify when the facet should be shown in frontend - Always or Conditionally, based on another facet/parameter having a value, specific or not.

Figure 3.1 Creating list facets

If multiple options are given the same label, they will be grouped together – which means that you can use list facets to group facet options under a particular label.

Please note that there is no built-in validation, the values you enter must fit the source data or the facet option will appear empty in frontend.

A term facet behaves almost identical to a field facet, except for the fact that it will only retrieve the 2048 most frequent terms from a field. This makes it possible to facet on fields with a lot of variance in terms without crippling performance completely.

To create a term facet:

  • Click Add field facet on the facet group page
  • Provide a facet name
  • Select a field to retrieve facet options from
  • Select a query parameter to pass the option values to
  • (Optional) Specify a render type

The Show section allows you to specify when the facet should be shown in frontend - Always or Conditionally, based on another facet/parameter having a value, specific or not.

Figure 4.1 Creating term facets

Cascading facets are facets where filters are shown or hidden depending on previously selected facet values. For instance, you have shop where you sell two things; fruit and cars. To help the customer find the right product you have three facets:

  • A Category facet where the customer chooses either Fruit or Cars
  • A Car model type facet where the customer can select Hatchback, Sedan, MPV, SUV & Convertible
  • A Fruit type facet where the customer can select Citrus, Strone fruit, Berries, Melons & Tropical

Obviously, you don’t want to show people interested in cars the fruit type facet – so you use the Show settings to specify that the Category parameter should have the value Fruit before showing the fruit type facet (Figure 5.1).

Figure 5.1 Using the show-settings on a facet to create cascading facets

In this manner, it is possible to create “decision trees” using facets, which is very useful for shops selling many different types of products.