Use an attribute as a facet

A facet is a dynamic search interface component that creates categorizes items using attribute values. They make it possible for visitors to filter search results using those categories. Facets can change based on a visitor's query.

The following procedures describe how you can configure attributes as facets.

Enable an attribute for use as a facet

To add an attribute and enable it as a facet:

  1. On the menu bar, click Administration > Domain Settings.

  2. Click Attributes.

  3. To search for the attribute you want to edit, in the search bar, enter the attribute name. Then click the attribute in the list. This opens the attribute editing dialog.

    Tip

    Note the value of the attribute's Attribute Name. This might be different than the display name and is necessary for feature configuration.

  4. On the Use For Features tab, select the Facets option. The Filters option is now selected automatically as this is required for facets to work as expected.

  5. Click Save.

  6. Click Publish. To confirm you want to publish, in the confirmation dialog, click OK.

Configure the facet at the domain level

Marking an attribute for use with facets is usually enough to create a facet. However, you can apply additional settings, such as choosing the facet sorting order or boosting a particular facet value. Numeric-based facets are built as a histogram in interval sized buckets. You can specify the interval and, optionally, list interval sized buckets.

In this example, you'll further configure the facet to:

  1. Show a maximum of 25 facet values. Default is 10.

  2. Display facets values in descending alphabetical order.

To configure the facet:

  1. On the menu bar, click Administration > Domain Setting > Feature Configuration.

  2. Click Facets , and then next to the facet you just added, click Edit .

  3. In the fields, refer to the following table and provide values.

    Field

    Description

    Use and example

    Label

    The display name for the attribute.

    For ease of maintenance, we recommend you also use this as the title for facet options in the search experience.

    Id

    ID of the facet. Can be used to reference facet in API requests.

    We recommend you don't change this option after its initial configuration.

    Aggregation type

    Describes how facet values are grouped or listed.

    Set automatically based on the the data type of the attribute.

    Set as Terms, for strings and arrays of strings.

    The following example shows a facet Type that has string values with Terms as its aggregation type. The count of the facet value is the number of indexed items with that attribute value.

    A Type facet showing one value Blogs with a count of 566.

    The following example shows a facet Review rating that has numeric values with Histogram as its aggregation type. Facet values are grouped in buckets where each one's size is configured as the interval. The count of the bucket is the number of indexed items with an attribute value falling within the bucket range.

    A Review Rating facet showing the 4-5 Starts bucket with a count of 62.

    Operator

    Defines how facet values in a request are used. Available options are:

    • And - Previously set facet values are retained and new facet value in the request is appended. Hard filter values configured for the page configuration apply too.

    • Dynamic Or - All previously set facet values are retained and the results can be grouped under one or all of the new facet values. Hard filter values configured for the page configuration apply too.

    • Static Or - All previous facets values are disregarded and only the hard filter values configured for the page configuration apply.

    • And - On a page configured to show car model of a particular brand, a visitor clicks a model and is displayed a list of years new models were available for sale. When the visitor selects a year, only the cars of the brand and model, and listed for the year are displayed. In this example, brand is configured as a hard filter in the page.

    • Dynamic Or - On a page showing publications classified byauthor and type. When the visitor clicks blog under type, the results displayed are all blogs, and all the authors listed are all blog authors. When the visitor clicks an author's name, the results are all publications by that author and all other blogs. In this example, publications is configured as a hard filter in the page.

    • Static Or - On a page showing publications classified byauthor and type. When the visitor clicks blog under type, the results displayed are all blogs, and all the authors listed are all blog authors. When the visitor clicks an author's name, the results are all publications by that author. In this example, publications is configured as a hard filter in the page.

    Order

    Sets the order facet values are returned in. Options available are Ascending alphabetical, Descending alphabetical, and Descending facet value count.

    By default, values are sorted with the highest number of associated content items appear on top or Descending facet value count.

    Warning

    Sorting a large number of facet values alphabetically ascending or descending can impact site performance.

    Max

    Number of facet values returned. The default is 10.

    We recommend you keep the value of this parameter as low as possible. Setting Max above 50 can greatly impact site performance and the absolute maximum is 100.

    Minimum documents

    Minimum number of items that must contain a value for this facet in order for it to be returned.

    If not specified, the value of this parameter defaults to 1.

    To show zero results if no items match facet criteria, set this option to 0.

    Boost list

    List containing values to be pushed to the top of list and values to be excluded.

    This parameter works only for facets with an aggregation type of Terms.

    If you include any values in the boost list, the rest of the values are displayed in ascending alphabetical order, regardless of the value of the Order option.

    The following image shows the list editing dialog where News, Blogs, and Events values for the Content type facet are boosted while the Others value is excluded.

    Screenshot of boost list dialog.

    Interval

    Size of each bucket in the response.

    This parameter is only used for facets with an aggregation type of Histogram.

    When interval is set to 3, buckets or value ranges are 1-3, 4-6, 7-9, and so on.

    Merge buckets

    Enable merge buckets to avoid empty buckets. This ignores the configured interval and calculates an interval that eliminated empty buckets.

    This parameter works only for facets with an aggregation type of Terms.

    When interval is set to 3 and values are 2, 3, 7, and 8, the 4-6 bucket would be empty. If merge buckets is enabled, the calculated interval is 4 and the buckets are 1-4 and 5-9.

  4. Click Save.

Enable the facet in the global widget

After you configure a facet, you need to enable it in the global widget. Optionally, you can specify the order of facets.

Note

If there is a conflict between the settings you configure in the Global Widget Settings and Feature Configuration, the global settings are used at runtime.

To set up a facet in the global widget:

  1. On the menu bar, click Global Resources, then click Global Widget.

  2. On the Global Widget Settings tab, click the Facets card.

  3. To enable the facet, next to the facet you configured, click Enable .

    Note

    To disable a facet, click Disable . Do this when you do not want a facet to appear, but you want to keep the facet's configuration for use later on.

  4. Optionally, to reorder facets, drag facets or use the Push to Top and Push To Bottom arrows.

  5. Click Save.

  6. Click Publish. Confirm the action when prompted.

Do you have some feedback for us?

If you have suggestions for improving this article,