Class Rule.PinAction.Builder (2.64.0)

public static final class Rule.PinAction.Builder extends GeneratedMessageV3.Builder<Rule.PinAction.Builder> implements Rule.PinActionOrBuilder

Pins one or more specified products to a specific position in the results.

  • Rule Condition: Must specify non-empty Condition.query_terms (for search only) or Condition.page_categories (for browse only), but can't specify both.

  • Action Input: mapping of [pin_position, product_id] pairs (pin position uses 1-based indexing).

  • Action Result: Will pin products with matching ids to the position specified in the final result order.

    Example: Suppose the query is shoes, the Condition.query_terms is shoes and the pin_map has {1, "pid1"}, then product with pid1 will be pinned to the top position in the final results.

    If multiple PinActions are matched to a single request the actions will be processed from most to least recently updated.

    Pins to positions larger than the max allowed page size of 120 are not allowed.

Protobuf type google.cloud.retail.v2alpha.Rule.PinAction

Static Methods

getDescriptor()

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

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public Rule.PinAction.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Rule.PinAction.Builder
Overrides

build()

public Rule.PinAction build()
Returns
Type Description
Rule.PinAction

buildPartial()

public Rule.PinAction buildPartial()
Returns
Type Description
Rule.PinAction

clear()

public Rule.PinAction.Builder clear()
Returns
Type Description
Rule.PinAction.Builder
Overrides

clearField(Descriptors.FieldDescriptor field)

public Rule.PinAction.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
Rule.PinAction.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

public Rule.PinAction.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
Rule.PinAction.Builder
Overrides

clearPinMap()

public Rule.PinAction.Builder clearPinMap()
Returns
Type Description
Rule.PinAction.Builder

clone()

public Rule.PinAction.Builder clone()
Returns
Type Description
Rule.PinAction.Builder
Overrides

containsPinMap(long key)

public boolean containsPinMap(long key)

Required. A map of positions to product_ids.

Partial matches per action are allowed, if a certain position in the map is already filled that [position, product_id] pair will be ignored but the rest may still be applied. This case will only occur if multiple pin actions are matched to a single request, as the map guarantees that pin positions are unique within the same action.

Duplicate product_ids are not permitted within a single pin map.

The max size of this map is 120, equivalent to the max request page size.

map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
key long
Returns
Type Description
boolean

getDefaultInstanceForType()

public Rule.PinAction getDefaultInstanceForType()
Returns
Type Description
Rule.PinAction

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getMutablePinMap() (deprecated)

public Map<Long,String> getMutablePinMap()

Use alternate mutation accessors instead.

Returns
Type Description
Map<java.lang.Long,String>

getPinMap() (deprecated)

public Map<Long,String> getPinMap()

Use #getPinMapMap() instead.

Returns
Type Description
Map<java.lang.Long,String>

getPinMapCount()

public int getPinMapCount()

Required. A map of positions to product_ids.

Partial matches per action are allowed, if a certain position in the map is already filled that [position, product_id] pair will be ignored but the rest may still be applied. This case will only occur if multiple pin actions are matched to a single request, as the map guarantees that pin positions are unique within the same action.

Duplicate product_ids are not permitted within a single pin map.

The max size of this map is 120, equivalent to the max request page size.

map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
int

getPinMapMap()

public Map<Long,String> getPinMapMap()

Required. A map of positions to product_ids.

Partial matches per action are allowed, if a certain position in the map is already filled that [position, product_id] pair will be ignored but the rest may still be applied. This case will only occur if multiple pin actions are matched to a single request, as the map guarantees that pin positions are unique within the same action.

Duplicate product_ids are not permitted within a single pin map.

The max size of this map is 120, equivalent to the max request page size.

map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
Map<java.lang.Long,String>

getPinMapOrDefault(long key, String defaultValue)

public String getPinMapOrDefault(long key, String defaultValue)

Required. A map of positions to product_ids.

Partial matches per action are allowed, if a certain position in the map is already filled that [position, product_id] pair will be ignored but the rest may still be applied. This case will only occur if multiple pin actions are matched to a single request, as the map guarantees that pin positions are unique within the same action.

Duplicate product_ids are not permitted within a single pin map.

The max size of this map is 120, equivalent to the max request page size.

map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];

Parameters
Name Description
key long
defaultValue String
Returns
Type Description
String

getPinMapOrThrow(long key)

public String getPinMapOrThrow(long key)

Required. A map of positions to product_ids.

Partial matches per action are allowed, if a certain position in the map is already filled that [position, product_id] pair will be ignored but the rest may still be applied. This case will only occur if multiple pin actions are matched to a single request, as the map guarantees that pin positions are unique within the same action.

Duplicate product_ids are not permitted within a single pin map.

The max size of this map is 120, equivalent to the max request page size.

map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
key long
Returns
Type Description
String

internalGetFieldAccessorTable()

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

internalGetMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMapFieldReflection(int)

internalGetMutableMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMutableMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int)

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(Rule.PinAction other)

public Rule.PinAction.Builder mergeFrom(Rule.PinAction other)
Parameter
Name Description
other Rule.PinAction
Returns
Type Description
Rule.PinAction.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public Rule.PinAction.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Rule.PinAction.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public Rule.PinAction.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
Rule.PinAction.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final Rule.PinAction.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Rule.PinAction.Builder
Overrides

putAllPinMap(Map<Long,String> values)

public Rule.PinAction.Builder putAllPinMap(Map<Long,String> values)

Required. A map of positions to product_ids.

Partial matches per action are allowed, if a certain position in the map is already filled that [position, product_id] pair will be ignored but the rest may still be applied. This case will only occur if multiple pin actions are matched to a single request, as the map guarantees that pin positions are unique within the same action.

Duplicate product_ids are not permitted within a single pin map.

The max size of this map is 120, equivalent to the max request page size.

map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
values Map<java.lang.Long,String>
Returns
Type Description
Rule.PinAction.Builder

putPinMap(long key, String value)

public Rule.PinAction.Builder putPinMap(long key, String value)

Required. A map of positions to product_ids.

Partial matches per action are allowed, if a certain position in the map is already filled that [position, product_id] pair will be ignored but the rest may still be applied. This case will only occur if multiple pin actions are matched to a single request, as the map guarantees that pin positions are unique within the same action.

Duplicate product_ids are not permitted within a single pin map.

The max size of this map is 120, equivalent to the max request page size.

map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];

Parameters
Name Description
key long
value String
Returns
Type Description
Rule.PinAction.Builder

removePinMap(long key)

public Rule.PinAction.Builder removePinMap(long key)

Required. A map of positions to product_ids.

Partial matches per action are allowed, if a certain position in the map is already filled that [position, product_id] pair will be ignored but the rest may still be applied. This case will only occur if multiple pin actions are matched to a single request, as the map guarantees that pin positions are unique within the same action.

Duplicate product_ids are not permitted within a single pin map.

The max size of this map is 120, equivalent to the max request page size.

map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
key long
Returns
Type Description
Rule.PinAction.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public Rule.PinAction.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Rule.PinAction.Builder
Overrides

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public Rule.PinAction.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
Rule.PinAction.Builder
Overrides

setUnknownFields(UnknownFieldSet unknownFields)

public final Rule.PinAction.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Rule.PinAction.Builder
Overrides