Class Rule (1.10.1)

Stay organized with collections Save and categorize content based on your preferences.
Rule(mapping=None, *, ignore_unknown_fields=False, **kwargs)

A rule is a condition-action pair

  • A condition defines when a rule is to be triggered.
  • An action specifies what occurs on that trigger. Currently rules only work for controls with SOLUTION_TYPE_SEARCH.

This message has oneof_ fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

.. _oneof:


A boost action. This field is a member of `oneof`_ ``action``.
Redirects a shopper to a specific page. This field is a member of `oneof`_ ``action``.
Treats specific term as a synonym with a group of terms. Group of terms will not be treated as synonyms with the specific term. This field is a member of `oneof`_ ``action``.
Prevents term from being associated with other terms. This field is a member of `oneof`_ ``action``.
Replaces specific terms in the query. This field is a member of `oneof`_ ``action``.
Ignores specific terms from query during search. This field is a member of `oneof`_ ``action``.
Filters results. This field is a member of `oneof`_ ``action``.
Treats a set of terms as synonyms of one another. This field is a member of `oneof`_ ``action``.
Required. The condition that triggers the rule. If the condition is empty, the rule will always apply.


builtins.object > proto.message.Message > Rule



BoostAction(mapping=None, *, ignore_unknown_fields=False, **kwargs)

A boost action to apply to results matching condition specified above.


DoNotAssociateAction(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Prevents query_term from being associated with specified terms during search. Example: Don't associate "gShoe" and "cheap".


FilterAction(mapping=None, *, ignore_unknown_fields=False, **kwargs)
  • Rule Condition:

    • No Condition.query_terms provided is a global match.
    • 1 or more Condition.query_terms provided are combined with OR operator.
  • Action Input: The request query and filter that are applied to the retrieved products, in addition to any filters already provided with the SearchRequest. The AND operator is used to combine the query's existing filters with the filter rule(s). NOTE: May result in 0 results when filters conflict.

  • Action Result: Filters the returned objects to be ONLY those that passed the filter.


IgnoreAction(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Prevents a term in the query from being used in search. Example: Don't search for "shoddy".


OnewaySynonymsAction(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Maps a set of terms to a set of synonyms. Set of synonyms will be treated as synonyms of each query term only. query_terms will not be treated as synonyms of each other. Example: "sneakers" will use a synonym of "shoes". "shoes" will not use a synonym of "sneakers".


RedirectAction(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Redirects a shopper to a specific page.

  • Rule Condition:

    • Must specify Condition.query_terms.
  • Action Input: Request Query

  • Action Result: Redirects shopper to provided uri.


ReplacementAction(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Replaces a term in the query. Multiple replacement candidates can be specified. All query_terms will be replaced with the replacement term. Example: Replace "gShoe" with "google shoe".


TwowaySynonymsAction(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Creates a set of terms that will be treated as synonyms of each other. Example: synonyms of "sneakers" and "shoes".

  • "sneakers" will use a synonym of "shoes".
  • "shoes" will use a synonym of "sneakers".