Class Rule (1.17.0)

  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: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

Attributes

Name
Description
boost_action
google.cloud.retail_v2alpha.types.Rule.BoostAction
A boost action. This field is a member of oneof _ action .
redirect_action
google.cloud.retail_v2alpha.types.Rule.RedirectAction
Redirects a shopper to a specific page. This field is a member of oneof _ action .
oneway_synonyms_action
google.cloud.retail_v2alpha.types.Rule.OnewaySynonymsAction
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 .
do_not_associate_action
google.cloud.retail_v2alpha.types.Rule.DoNotAssociateAction
Prevents term from being associated with other terms. This field is a member of oneof _ action .
replacement_action
google.cloud.retail_v2alpha.types.Rule.ReplacementAction
Replaces specific terms in the query. This field is a member of oneof _ action .
ignore_action
google.cloud.retail_v2alpha.types.Rule.IgnoreAction
Ignores specific terms from query during search. This field is a member of oneof _ action .
filter_action
google.cloud.retail_v2alpha.types.Rule.FilterAction
Filters results. This field is a member of oneof _ action .
twoway_synonyms_action
google.cloud.retail_v2alpha.types.Rule.TwowaySynonymsAction
Treats a set of terms as synonyms of one another. This field is a member of oneof _ action .
condition
google.cloud.retail_v2alpha.types.Condition
Required. The condition that triggers the rule. If the condition is empty, the rule will always apply.

Classes

BoostAction

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

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

DoNotAssociateAction

  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

  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

  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

  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

  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

  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

  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".
Create a Mobile Website
View Site in Mobile | Classic
Share by: