This page introduces the facet features and how to use them.
Facet controls
This section provides instructions for creating different types of facet controls:
- Ignore facet values controls
- Replace facet values controls
- Set numerical intervals controls
- Remove facets controls
- Force return facets 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:
Go to the Retail Controls page in the Google Cloud console.
On the Facet controls tab, click add_boxCreate control.
The Create control pane opens.
Select Ignore facet values.
Specify the attribute name.
For example,
brands
for a system attribute. For a custom attribute, the name starts withattributes.
—for example,attributes.department
andattributes.colors
.Optional: Specify Start Time and/or End Time.
Specify one or more attribute values as Ignore values.
For example,
NA
,Not_applicable
andEaster
.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:
Go to the Retail Controls page in the Google Cloud console.
On the Facet controls tab, click add_boxCreate control.
The Create control pane opens.
Select Replace facet values.
Specify the attribute name.
For example,
brands
for a system attribute. For a custom attribute, the name starts withattributes.
—for example,attributes.department
andattributes.colors
.Specify one or more attribute values as Replace values.
For example,
RED
,Red
,dark red
,bright red
,ruby
, andcrimson
.An attribute value can only appear once in the Replace values field.
Specify a single attribute value as Replacement term, for example,
red
.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:
Go to the Retail Controls page in the Google Cloud console.
On the Facet controls tab, click add_boxCreate control.
The Create control pane opens.
Select Set numerical intervals.
Specify the name of a numerical attribute.
For example,
price
for a system attribute. For a custom attribute, the name starts withattributes.
—for example,attributes.number_of_pieces
.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.
To add more intervals, click on + Add intervals. The maximum number of intervals is 40.
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:
Go to the Retail Controls page in the Google Cloud console.
On the Facet controls tab, click add_boxCreate control.
The Create control pane opens.
Select Remove facets.
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
andfall 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.
Specify at least one valid facet key in Attributes to ignore.
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:
Go to the Retail Controls page in the Google Cloud console.
On the Facet controls tab, click add_boxCreate control.
The Create control pane opens.
Select Force return facets.
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
andfall 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.
Specify a valid facet key and an integer position between 1 and 100 (inclusive).
If you want to specify more than one facet key, click +Add Adjustment and redo the previous step.
Click Submit.