public sealed class Rule.Types.PinAction : IMessage<Rule.Types.PinAction>, IEquatable<Rule.Types.PinAction>, IDeepCloneable<Rule.Types.PinAction>, IBufferMessage, IMessage
Reference documentation and code samples for the Retail v2 API class Rule.Types.PinAction.
Pins one or more specified products to a specific position in the
results.
Rule Condition:
Must specify non-empty
[Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
(for search only) or
[Condition.page_categories][google.cloud.retail.v2.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][google.cloud.retail.v2.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.
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"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Retail v2 API - Class Rule.Types.PinAction (2.14.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.14.0 (latest)](/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [2.13.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/2.13.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [2.12.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/2.12.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [2.11.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/2.11.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [2.10.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/2.10.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [2.9.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/2.9.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [2.8.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/2.8.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [2.7.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/2.7.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [2.6.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/2.6.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/2.5.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/2.4.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/2.3.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/2.2.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/2.1.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/2.0.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [1.6.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/1.6.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [1.5.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/1.5.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [1.4.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/1.4.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/1.3.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/1.2.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/1.1.0/Google.Cloud.Retail.V2.Rule.Types.PinAction)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.Retail.V2/1.0.0/Google.Cloud.Retail.V2.Rule.Types.PinAction) \n\n public sealed class Rule.Types.PinAction : IMessage\u003cRule.Types.PinAction\u003e, IEquatable\u003cRule.Types.PinAction\u003e, IDeepCloneable\u003cRule.Types.PinAction\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Retail v2 API class Rule.Types.PinAction.\n\nPins one or more specified products to a specific position in the\nresults.\n\n- Rule Condition:\n Must specify non-empty\n \\[Condition.query_terms\\]\\[google.cloud.retail.v2.Condition.query_terms\\]\n (for search only) or\n \\[Condition.page_categories\\]\\[google.cloud.retail.v2.Condition.page_categories\\]\n (for browse only), but can't specify both.\n\n- Action Input: mapping of `[pin_position, product_id]` pairs (pin position\n uses 1-based indexing).\n\n- Action Result: Will pin products with matching ids to the position\n specified in the final result order.\n\nExample: Suppose the query is `shoes`, the\n\\[Condition.query_terms\\]\\[google.cloud.retail.v2.Condition.query_terms\\] is\n`shoes` and the pin_map has `{1, \"pid1\"}`, then product with `pid1` will be\npinned to the top position in the final results.\n\nIf multiple PinActions are matched to a single request the actions will\nbe processed from most to least recently updated.\n\nPins to positions larger than the max allowed page size of 120 are not\nallowed. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e Rule.Types.PinAction \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[Rule](/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.Rule)[Types](/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.Rule.Types)[PinAction](/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.Rule.Types.PinAction), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Rule](/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.Rule)[Types](/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.Rule.Types)[PinAction](/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.Rule.Types.PinAction), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[Rule](/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.Rule)[Types](/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.Rule.Types)[PinAction](/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.Rule.Types.PinAction), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Retail.V2](/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2)\n\nAssembly\n--------\n\nGoogle.Cloud.Retail.V2.dll\n\nConstructors\n------------\n\n### PinAction()\n\n public PinAction()\n\n### PinAction(PinAction)\n\n public PinAction(Rule.Types.PinAction other)\n\nProperties\n----------\n\n### PinMap\n\n public MapField\u003clong, string\u003e PinMap { get; }\n\nRequired. A map of positions to product_ids.\n\nPartial matches per action are allowed, if a certain position in the map\nis already filled that `[position, product_id]` pair will be ignored\nbut the rest may still be applied. This case will only occur if multiple\npin actions are matched to a single request, as the map guarantees that\npin positions are unique within the same action.\n\nDuplicate product_ids are not permitted within a single pin map.\n\nThe max size of this map is 120, equivalent to the max [request page\nsize](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body)."]]