Facets for search

This page introduces the facet features and how to use them.

Facet controls

This section provides instructions for creating different types of facet controls:

Retail performs case-sensitive matching for all these facet controls unless stated otherwise.

Create an ignore facet values control

Create an ignore facet values control when you want to remove some unwanted facet values for some specific facet keys.

This control is useful to erase unwanted facet values like NA and Not_applicable. But, it can also be used to erase seasonal trends like Easter if you are in October.

To create a control that ignores facet values:

  1. Go to the Retail Controls page in the Google Cloud console.

    Go to the Controls page

  2. On the Facet controls tab, click Create control.

    The Create control pane opens.

  3. Select Ignore facet values.

  4. Specify the attribute name.

    For example, brands for a system attribute. For a custom attribute, the name starts with attributes.—for example, attributes.department and attributes.colors.

  5. Optional: Specify Start Time and/or End Time.

  6. Specify one or more attribute values as Ignore values.

    For example, NA, Not_applicable and Easter.

  7. Click Submit.

Create a replace facet values control

Create a replace facet values control when you want to consolidate a number of similar facet values into one single term.

Replacing facet values is sometimes referred to as merging facet values.

To avoid conflicts and useless mappings, if an attribute value facet_value_1 is replaced by another attribute value facet_value_2, then the latter can't be replaced by another attribute value. For example, if you replace ruby with dark red, you can't subsequently replace dark red with red.

For each attribute name, an attribute value shouldn't appear more than once in the Replace values field.

To create a control that replaces facet values:

  1. Go to the Retail Controls page in the Google Cloud console.

    Go to the Controls page

  2. On the Facet controls tab, click Create control.

    The Create control pane opens.

  3. Select Replace facet values.

  4. Specify the attribute name.

    For example, brands for a system attribute. For a custom attribute, the name starts with attributes.—for example, attributes.department and attributes.colors.

  5. Specify one or more attribute values as Replace values.

    For example, RED, Red, dark red, bright red, ruby, and crimson.

    An attribute value can only appear once in the Replace values field.

  6. Specify a single attribute value as Replacement term, for example, red.

  7. Click Submit.

Although the replaced values might disappear quickly, the replacement terms can take up to 2 days to appear.

When the replace facet values control takes effect, if the facet key (in this example attributes.colors) is returned in the response, the replaced facet values (such as dark red and crimson) won't be present as facet values. They are replaced by their replacement terms (for example, red).

Create a set numerical intervals control

The set numerical intervals control allows you to determine the intervals for a numeric facet instead of having to accept calculated intervals.

For example, we might calculate the intervals [10,15), [15,20) [20,25), [25,30), [30,40) and [40,50) and [50,infinity) for the custom numerical facet key attributes.monitor_size. But, you might prefer the intervals [0,14), [14,17), [17,21), [21,24), [24,27), [27,32) and [32,infinity) instead.

About calculated intervals and set intervals

For all numerical custom attributes and the numerical system attributes price, rating and ratingCount, we calculate some intervals with round bounds based on the distribution of all the (numerical) attribute values for each of these attributes. You can also specify some intervals in the request. As a last option, you can set your own intervals for each numerical facet key using the following set numerical intervals controls.

Here is the priority order that determines which intervals are used:

  • First, if some intervals are specified in the request for a numerical facet key, these intervals are kept.

  • Otherwise, if a numerical facet key is dynamic or passed in the request without intervals, then the intervals that you include using the set numerical intervals controls are added to that numerical facet key if these intervals are non-empty.

  • Otherwise, the previously mentioned calculated intervals with round bounds are be added.

Create the control

If you want to specify your own intervals for numeric facet keys instead of using the ones that Retail calculates for you, then create a set numerical intervals controls.

To create a control for adding intervals:

  1. Go to the Retail Controls page in the Google Cloud console.

    Go to the Controls page

  2. On the Facet controls tab, click Create control.

    The Create control pane opens.

  3. Select Set numerical intervals.

  4. Specify the name of a numerical attribute.

    For example, price for a system attribute. For a custom attribute, the name starts with attributes.—for example, attributes.number_of_pieces.

  5. Specify at least one of Minimum or Maximum. If both are specified, the minimum can't be greater than the maximum. You can choose each bound to be Inclusive or Exclusive.

  6. To add more intervals, click on + Add intervals. The maximum number of intervals is 40.

  7. Click Submit.

Create a remove facets control

The remove facets control allows you to remove a specific facet key from the dynamic facets. Facet keys are removed based on some given query terms or page categories.

This control is useful if you want to remove some facet keys for some query terms or browse. For example, you can use this control to remove the facet key attributes._shoe_size for the query 'shoes'.

To create a control for remove facet:

  1. Go to the Retail Controls page in the Google Cloud console.

    Go to the Controls page

  2. On the Facet controls tab, click Create control.

    The Create control pane opens.

  3. Select Remove facets.

  4. Each control is for search or browse, but it can't apply to both. Do one of the following:

    • For search queries, click Search and specify some partial query terms or some exact query terms to match. See detailed information in query terms and conditions. The query terms need to be lowercase for both cases. For example, you can specify the partial query terms shirts, polo, jackets, t-shirt and fall coats and the facet keys specified next won't appear as a dynamic facet if the lowercase query is one of these query terms or contains any of these query terms as a unigram.

    • For browse, click Browse categories and specify some page categories. You can specify a list (up to 10 entries) of categories or departments. The format should be the same as the user event page categories. For example, it could be page_categories : Sales > 2023 Black Friday Deals. If there is an exact match (case sensitive) between the latter and one of the page categories passed in the event (for browse), then the facet keys specified next won't appear as a dynamic facet.

  5. Specify at least one valid facet key in Attributes to ignore.

  6. Click Submit.

Create a force return facets control

The force return facets control can affect the list position of a dynamic facet key for a specific query or browse event.

This control is useful if you want to force a specific facet key among the dynamic facets for some query terms or browse. For example, you can use this control to force the facet key brands to appear to position 10 or above for the query handbags. If the facet brands is already in the top 10 for the dynamic facets for this query, then it should not move much. If it is not in the top 10 or not in the list of dynamic facets, then it should move to position 10 approximately.

To create a control for force return facet:

  1. Go to the Retail Controls page in the Google Cloud console.

    Go to the Controls page

  2. On the Facet controls tab, click Create control.

    The Create control pane opens.

  3. Select Force return facets.

  4. Each control is for search or browse, but it can't apply to both. Do one of the following:

    • For search queries, click Search and specify some partial query terms or some exact query terms to match. See detailed information in query terms and conditions. The query terms need to be lowercase for both cases. For example, you can specify the partial query terms shirts, polo, jackets, t-shirt and fall coats and the facet keys specified next should appear around their respective position or above among the dynamic facets if the lowercase query is one of these query terms or contains any of these query terms as a unigram.

    • For browse, click Browse categories and specify some page categories. You can specify a list (up to 10 entries) of categories or departments. The format should be the same as the user event page categories. For example, it could be page_categories : Sales > 2023 Black Friday Deals. If there is an exact match (case sensitive) between the latter and one of the page categories passed in the event (for browse), then the facet keys specified next should appear around their respective position or above among the dynamic facets.

  5. Specify a valid facet key and an integer position between 1 and 100 (inclusive).

  6. If you want to specify more than one facet key, click +Add Adjustment and redo the previous step.

  7. Click Submit.