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.
Attribute
Name
Description
pin_map
MutableMapping[int, str]
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
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Class PinAction (2.5.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.5.0 (latest)](/python/docs/reference/retail/latest/google.cloud.retail_v2.types.Rule.PinAction)\n- [2.4.0](/python/docs/reference/retail/2.4.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [2.3.0](/python/docs/reference/retail/2.3.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [2.2.0](/python/docs/reference/retail/2.2.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [2.1.0](/python/docs/reference/retail/2.1.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [2.0.0](/python/docs/reference/retail/2.0.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.25.0](/python/docs/reference/retail/1.25.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.24.0](/python/docs/reference/retail/1.24.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.23.1](/python/docs/reference/retail/1.23.1/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.22.0](/python/docs/reference/retail/1.22.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.21.2](/python/docs/reference/retail/1.21.2/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.20.1](/python/docs/reference/retail/1.20.1/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.19.1](/python/docs/reference/retail/1.19.1/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.18.0](/python/docs/reference/retail/1.18.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.17.0](/python/docs/reference/retail/1.17.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.16.3](/python/docs/reference/retail/1.16.3/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.15.1](/python/docs/reference/retail/1.15.1/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.14.1](/python/docs/reference/retail/1.14.1/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.13.0](/python/docs/reference/retail/1.13.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.12.0](/python/docs/reference/retail/1.12.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.11.0](/python/docs/reference/retail/1.11.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.10.2](/python/docs/reference/retail/1.10.2/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.9.0](/python/docs/reference/retail/1.9.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.8.1](/python/docs/reference/retail/1.8.1/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.7.0](/python/docs/reference/retail/1.7.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.6.1](/python/docs/reference/retail/1.6.1/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.5.0](/python/docs/reference/retail/1.5.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.4.1](/python/docs/reference/retail/1.4.1/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.3.0](/python/docs/reference/retail/1.3.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.2.1](/python/docs/reference/retail/1.2.1/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.1.0](/python/docs/reference/retail/1.1.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [1.0.2](/python/docs/reference/retail/1.0.2/google.cloud.retail_v2.types.Rule.PinAction)\n- [0.4.2](/python/docs/reference/retail/0.4.2/google.cloud.retail_v2.types.Rule.PinAction)\n- [0.3.1](/python/docs/reference/retail/0.3.1/google.cloud.retail_v2.types.Rule.PinAction)\n- [0.2.0](/python/docs/reference/retail/0.2.0/google.cloud.retail_v2.types.Rule.PinAction)\n- [0.1.0](/python/docs/reference/retail/0.1.0/google.cloud.retail_v2.types.Rule.PinAction) \n\n PinAction(mapping=None, *, ignore_unknown_fields=False, **kwargs)\n\nPins one or more specified products to a specific position in the\nresults.\n\n- Rule Condition: Must specify non-empty\n Condition.query_terms\n (for search only) or\n Condition.page_categories\n (for browse only), but can't specify both.\n\n- Action Input: mapping of `[pin_position, product_id]` pairs\n (pin position uses 1-based indexing).\n\n- Action Result: Will pin products with matching ids to the\n position specified in the final result order.\n\nExample: Suppose the query is `shoes`, the\nCondition.query_terms\nis `shoes` and the pin_map has `{1, \"pid1\"}`, then product with\n`pid1` will be pinned to the top position in the final results.\n\nIf multiple PinActions are matched to a single request the actions\nwill be processed from most to least recently updated.\n\nPins to positions larger than the max allowed page size of 120 are\nnot allowed.\n\nClasses\n-------\n\n### PinMapEntry\n\n PinMapEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)\n\nThe abstract base class for a message."]]