Class Rule (2.53.0)

public final class Rule extends GeneratedMessageV3 implements RuleOrBuilder

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.

Protobuf type google.cloud.retail.v2beta.Rule

Implements

RuleOrBuilder

Static Fields

BOOST_ACTION_FIELD_NUMBER

public static final int BOOST_ACTION_FIELD_NUMBER
Field Value
Type Description
int

CONDITION_FIELD_NUMBER

public static final int CONDITION_FIELD_NUMBER
Field Value
Type Description
int

DO_NOT_ASSOCIATE_ACTION_FIELD_NUMBER

public static final int DO_NOT_ASSOCIATE_ACTION_FIELD_NUMBER
Field Value
Type Description
int

FILTER_ACTION_FIELD_NUMBER

public static final int FILTER_ACTION_FIELD_NUMBER
Field Value
Type Description
int

FORCE_RETURN_FACET_ACTION_FIELD_NUMBER

public static final int FORCE_RETURN_FACET_ACTION_FIELD_NUMBER
Field Value
Type Description
int

IGNORE_ACTION_FIELD_NUMBER

public static final int IGNORE_ACTION_FIELD_NUMBER
Field Value
Type Description
int

ONEWAY_SYNONYMS_ACTION_FIELD_NUMBER

public static final int ONEWAY_SYNONYMS_ACTION_FIELD_NUMBER
Field Value
Type Description
int

REDIRECT_ACTION_FIELD_NUMBER

public static final int REDIRECT_ACTION_FIELD_NUMBER
Field Value
Type Description
int

REMOVE_FACET_ACTION_FIELD_NUMBER

public static final int REMOVE_FACET_ACTION_FIELD_NUMBER
Field Value
Type Description
int

REPLACEMENT_ACTION_FIELD_NUMBER

public static final int REPLACEMENT_ACTION_FIELD_NUMBER
Field Value
Type Description
int

TWOWAY_SYNONYMS_ACTION_FIELD_NUMBER

public static final int TWOWAY_SYNONYMS_ACTION_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static Rule getDefaultInstance()
Returns
Type Description
Rule

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

newBuilder()

public static Rule.Builder newBuilder()
Returns
Type Description
Rule.Builder

newBuilder(Rule prototype)

public static Rule.Builder newBuilder(Rule prototype)
Parameter
Name Description
prototype Rule
Returns
Type Description
Rule.Builder

parseDelimitedFrom(InputStream input)

public static Rule parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Rule
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Rule parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Rule
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static Rule parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
Rule
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Rule parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Rule
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Rule parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
Rule
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Rule parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Rule
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Rule parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
Rule
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Rule parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Rule
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static Rule parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Rule
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Rule parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Rule
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static Rule parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
Rule
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Rule parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Rule
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<Rule> parser()
Returns
Type Description
Parser<Rule>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getActionCase()

public Rule.ActionCase getActionCase()
Returns
Type Description
Rule.ActionCase

getBoostAction()

public Rule.BoostAction getBoostAction()

A boost action.

.google.cloud.retail.v2beta.Rule.BoostAction boost_action = 2;

Returns
Type Description
Rule.BoostAction

The boostAction.

getBoostActionOrBuilder()

public Rule.BoostActionOrBuilder getBoostActionOrBuilder()

A boost action.

.google.cloud.retail.v2beta.Rule.BoostAction boost_action = 2;

Returns
Type Description
Rule.BoostActionOrBuilder

getCondition()

public Condition getCondition()

Required. The condition that triggers the rule. If the condition is empty, the rule will always apply.

.google.cloud.retail.v2beta.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
Condition

The condition.

getConditionOrBuilder()

public ConditionOrBuilder getConditionOrBuilder()

Required. The condition that triggers the rule. If the condition is empty, the rule will always apply.

.google.cloud.retail.v2beta.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
ConditionOrBuilder

getDefaultInstanceForType()

public Rule getDefaultInstanceForType()
Returns
Type Description
Rule

getDoNotAssociateAction()

public Rule.DoNotAssociateAction getDoNotAssociateAction()

Prevents term from being associated with other terms.

.google.cloud.retail.v2beta.Rule.DoNotAssociateAction do_not_associate_action = 7;

Returns
Type Description
Rule.DoNotAssociateAction

The doNotAssociateAction.

getDoNotAssociateActionOrBuilder()

public Rule.DoNotAssociateActionOrBuilder getDoNotAssociateActionOrBuilder()

Prevents term from being associated with other terms.

.google.cloud.retail.v2beta.Rule.DoNotAssociateAction do_not_associate_action = 7;

Returns
Type Description
Rule.DoNotAssociateActionOrBuilder

getFilterAction()

public Rule.FilterAction getFilterAction()

Filters results.

.google.cloud.retail.v2beta.Rule.FilterAction filter_action = 10;

Returns
Type Description
Rule.FilterAction

The filterAction.

getFilterActionOrBuilder()

public Rule.FilterActionOrBuilder getFilterActionOrBuilder()

Filters results.

.google.cloud.retail.v2beta.Rule.FilterAction filter_action = 10;

Returns
Type Description
Rule.FilterActionOrBuilder

getForceReturnFacetAction()

public Rule.ForceReturnFacetAction getForceReturnFacetAction()

Force returns an attribute as a facet in the request.

.google.cloud.retail.v2beta.Rule.ForceReturnFacetAction force_return_facet_action = 12;

Returns
Type Description
Rule.ForceReturnFacetAction

The forceReturnFacetAction.

getForceReturnFacetActionOrBuilder()

public Rule.ForceReturnFacetActionOrBuilder getForceReturnFacetActionOrBuilder()

Force returns an attribute as a facet in the request.

.google.cloud.retail.v2beta.Rule.ForceReturnFacetAction force_return_facet_action = 12;

Returns
Type Description
Rule.ForceReturnFacetActionOrBuilder

getIgnoreAction()

public Rule.IgnoreAction getIgnoreAction()

Ignores specific terms from query during search.

.google.cloud.retail.v2beta.Rule.IgnoreAction ignore_action = 9;

Returns
Type Description
Rule.IgnoreAction

The ignoreAction.

getIgnoreActionOrBuilder()

public Rule.IgnoreActionOrBuilder getIgnoreActionOrBuilder()

Ignores specific terms from query during search.

.google.cloud.retail.v2beta.Rule.IgnoreAction ignore_action = 9;

Returns
Type Description
Rule.IgnoreActionOrBuilder

getOnewaySynonymsAction()

public Rule.OnewaySynonymsAction getOnewaySynonymsAction()

Treats specific term as a synonym with a group of terms. Group of terms will not be treated as synonyms with the specific term.

.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction oneway_synonyms_action = 6;

Returns
Type Description
Rule.OnewaySynonymsAction

The onewaySynonymsAction.

getOnewaySynonymsActionOrBuilder()

public Rule.OnewaySynonymsActionOrBuilder getOnewaySynonymsActionOrBuilder()

Treats specific term as a synonym with a group of terms. Group of terms will not be treated as synonyms with the specific term.

.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction oneway_synonyms_action = 6;

Returns
Type Description
Rule.OnewaySynonymsActionOrBuilder

getParserForType()

public Parser<Rule> getParserForType()
Returns
Type Description
Parser<Rule>
Overrides

getRedirectAction()

public Rule.RedirectAction getRedirectAction()

Redirects a shopper to a specific page.

.google.cloud.retail.v2beta.Rule.RedirectAction redirect_action = 3;

Returns
Type Description
Rule.RedirectAction

The redirectAction.

getRedirectActionOrBuilder()

public Rule.RedirectActionOrBuilder getRedirectActionOrBuilder()

Redirects a shopper to a specific page.

.google.cloud.retail.v2beta.Rule.RedirectAction redirect_action = 3;

Returns
Type Description
Rule.RedirectActionOrBuilder

getRemoveFacetAction()

public Rule.RemoveFacetAction getRemoveFacetAction()

Remove an attribute as a facet in the request (if present).

.google.cloud.retail.v2beta.Rule.RemoveFacetAction remove_facet_action = 13;

Returns
Type Description
Rule.RemoveFacetAction

The removeFacetAction.

getRemoveFacetActionOrBuilder()

public Rule.RemoveFacetActionOrBuilder getRemoveFacetActionOrBuilder()

Remove an attribute as a facet in the request (if present).

.google.cloud.retail.v2beta.Rule.RemoveFacetAction remove_facet_action = 13;

Returns
Type Description
Rule.RemoveFacetActionOrBuilder

getReplacementAction()

public Rule.ReplacementAction getReplacementAction()

Replaces specific terms in the query.

.google.cloud.retail.v2beta.Rule.ReplacementAction replacement_action = 8;

Returns
Type Description
Rule.ReplacementAction

The replacementAction.

getReplacementActionOrBuilder()

public Rule.ReplacementActionOrBuilder getReplacementActionOrBuilder()

Replaces specific terms in the query.

.google.cloud.retail.v2beta.Rule.ReplacementAction replacement_action = 8;

Returns
Type Description
Rule.ReplacementActionOrBuilder

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

getTwowaySynonymsAction()

public Rule.TwowaySynonymsAction getTwowaySynonymsAction()

Treats a set of terms as synonyms of one another.

.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction twoway_synonyms_action = 11;

Returns
Type Description
Rule.TwowaySynonymsAction

The twowaySynonymsAction.

getTwowaySynonymsActionOrBuilder()

public Rule.TwowaySynonymsActionOrBuilder getTwowaySynonymsActionOrBuilder()

Treats a set of terms as synonyms of one another.

.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction twoway_synonyms_action = 11;

Returns
Type Description
Rule.TwowaySynonymsActionOrBuilder

hasBoostAction()

public boolean hasBoostAction()

A boost action.

.google.cloud.retail.v2beta.Rule.BoostAction boost_action = 2;

Returns
Type Description
boolean

Whether the boostAction field is set.

hasCondition()

public boolean hasCondition()

Required. The condition that triggers the rule. If the condition is empty, the rule will always apply.

.google.cloud.retail.v2beta.Condition condition = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
boolean

Whether the condition field is set.

hasDoNotAssociateAction()

public boolean hasDoNotAssociateAction()

Prevents term from being associated with other terms.

.google.cloud.retail.v2beta.Rule.DoNotAssociateAction do_not_associate_action = 7;

Returns
Type Description
boolean

Whether the doNotAssociateAction field is set.

hasFilterAction()

public boolean hasFilterAction()

Filters results.

.google.cloud.retail.v2beta.Rule.FilterAction filter_action = 10;

Returns
Type Description
boolean

Whether the filterAction field is set.

hasForceReturnFacetAction()

public boolean hasForceReturnFacetAction()

Force returns an attribute as a facet in the request.

.google.cloud.retail.v2beta.Rule.ForceReturnFacetAction force_return_facet_action = 12;

Returns
Type Description
boolean

Whether the forceReturnFacetAction field is set.

hasIgnoreAction()

public boolean hasIgnoreAction()

Ignores specific terms from query during search.

.google.cloud.retail.v2beta.Rule.IgnoreAction ignore_action = 9;

Returns
Type Description
boolean

Whether the ignoreAction field is set.

hasOnewaySynonymsAction()

public boolean hasOnewaySynonymsAction()

Treats specific term as a synonym with a group of terms. Group of terms will not be treated as synonyms with the specific term.

.google.cloud.retail.v2beta.Rule.OnewaySynonymsAction oneway_synonyms_action = 6;

Returns
Type Description
boolean

Whether the onewaySynonymsAction field is set.

hasRedirectAction()

public boolean hasRedirectAction()

Redirects a shopper to a specific page.

.google.cloud.retail.v2beta.Rule.RedirectAction redirect_action = 3;

Returns
Type Description
boolean

Whether the redirectAction field is set.

hasRemoveFacetAction()

public boolean hasRemoveFacetAction()

Remove an attribute as a facet in the request (if present).

.google.cloud.retail.v2beta.Rule.RemoveFacetAction remove_facet_action = 13;

Returns
Type Description
boolean

Whether the removeFacetAction field is set.

hasReplacementAction()

public boolean hasReplacementAction()

Replaces specific terms in the query.

.google.cloud.retail.v2beta.Rule.ReplacementAction replacement_action = 8;

Returns
Type Description
boolean

Whether the replacementAction field is set.

hasTwowaySynonymsAction()

public boolean hasTwowaySynonymsAction()

Treats a set of terms as synonyms of one another.

.google.cloud.retail.v2beta.Rule.TwowaySynonymsAction twoway_synonyms_action = 11;

Returns
Type Description
boolean

Whether the twowaySynonymsAction field is set.

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public Rule.Builder newBuilderForType()
Returns
Type Description
Rule.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Rule.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
Rule.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

public Rule.Builder toBuilder()
Returns
Type Description
Rule.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException