@@ -39,7 +39,7 @@ enum AttributeConfigLevel {
3939 PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1 ;
4040
4141 // At this level, we honor the attribute configurations set in
42- // [ CatalogConfig.attribute_configs][] .
42+ // ` CatalogConfig.attribute_configs` .
4343 CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2 ;
4444}
4545
@@ -367,6 +367,48 @@ message Rule {
367367 repeated string attribute_names = 1 ;
368368 }
369369
370+ // Pins one or more specified products to a specific position in the
371+ // results.
372+ //
373+ // * Rule Condition:
374+ // Must specify non-empty
375+ // [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
376+ // (for search only) or
377+ // [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
378+ // (for browse only), but can't specify both.
379+ //
380+ // * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
381+ // uses 1-based indexing).
382+ //
383+ // * Action Result: Will pin products with matching ids to the position
384+ // specified in the final result order.
385+ //
386+ // Example: Suppose the query is `shoes`, the
387+ // [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
388+ // `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
389+ // pinned to the top position in the final results.
390+ //
391+ // If multiple PinActions are matched to a single request the actions will
392+ // be processed from most to least recently updated.
393+ //
394+ // Pins to positions larger than the max allowed page size of 120 are not
395+ // allowed.
396+ message PinAction {
397+ // Required. A map of positions to product_ids.
398+ //
399+ // Partial matches per action are allowed, if a certain position in the map
400+ // is already filled that `[position, product_id]` pair will be ignored
401+ // but the rest may still be applied. This case will only occur if multiple
402+ // pin actions are matched to a single request, as the map guarantees that
403+ // pin positions are unique within the same action.
404+ //
405+ // Duplicate product_ids are not permitted within a single pin map.
406+ //
407+ // The max size of this map is 120, equivalent to the max [request page
408+ // size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
409+ map <int64 , string > pin_map = 1 [(google.api.field_behavior ) = REQUIRED ];
410+ }
411+
370412 // An action must be provided.
371413 oneof action {
372414 // A boost action.
@@ -399,6 +441,10 @@ message Rule {
399441
400442 // Remove an attribute as a facet in the request (if present).
401443 RemoveFacetAction remove_facet_action = 13 ;
444+
445+ // Pins one or more specified products to a specific position in the
446+ // results.
447+ PinAction pin_action = 14 ;
402448 }
403449
404450 // Required. The condition that triggers the rule.
@@ -443,9 +489,9 @@ message Audience {
443489message ColorInfo {
444490 // The standard color families. Strongly recommended to use the following
445491 // standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple",
446- // "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and
447- // "Mixed". Normally it is expected to have only 1 color family. May consider
448- // using single "Mixed" instead of multiple values.
492+ // "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and "Mixed".
493+ // Normally it is expected to have only 1 color family. May consider using
494+ // single "Mixed" instead of multiple values.
449495 //
450496 // A maximum of 5 values are allowed. Each value must be a UTF-8 encoded
451497 // string with a length limit of 128 characters. Otherwise, an
@@ -454,6 +500,10 @@ message ColorInfo {
454500 // Google Merchant Center property
455501 // [color](https://support.google.com/merchants/answer/6324487). Schema.org
456502 // property [Product.color](https://schema.org/color).
503+ //
504+ // The colorFamilies field as a system attribute is not a required field but
505+ // strongly recommended to be specified. Google Search models treat this field
506+ // as more important than a custom product attribute when specified.
457507 repeated string color_families = 1 ;
458508
459509 // The color display names, which may be different from standard color family
@@ -565,9 +615,10 @@ message FulfillmentInfo {
565615}
566616
567617// [Product][google.cloud.retail.v2.Product] image. Recommendations AI and
568- // Retail Search do not use product images to improve prediction and search
569- // results. However, product images can be returned in results, and are shown in
570- // prediction or search previews in the console.
618+ // Retail Search use product images to improve prediction and search results.
619+ // Product images can be returned in results, and are shown in prediction or
620+ // search previews in the console. Please try to provide correct product images
621+ // and avoid using images with size too small.
571622message Image {
572623 // Required. URI of the image.
573624 //
@@ -782,9 +833,7 @@ message UserInfo {
782833 // is set.
783834 string ip_address = 2 ;
784835
785- // User agent as included in the HTTP header. Required for getting
786- // [SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results].
787- //
836+ // User agent as included in the HTTP header.
788837 // The field must be a UTF-8 encoded string with a length limit of 1,000
789838 // characters. Otherwise, an INVALID_ARGUMENT error is returned.
790839 //
@@ -811,17 +860,17 @@ message UserInfo {
811860// The inventory information at a place (e.g. a store) identified
812861// by a place ID.
813862message LocalInventory {
814- // The place ID for the current set of inventory information.
815- string place_id = 1 ;
863+ // Optional. The place ID for the current set of inventory information.
864+ string place_id = 1 [ (google.api .field_behavior ) = OPTIONAL ] ;
816865
817- // Product price and cost information.
866+ // Optional. Product price and cost information.
818867 //
819868 // Google Merchant Center property
820869 // [price](https://support.google.com/merchants/answer/6324371).
821- PriceInfo price_info = 2 ;
870+ PriceInfo price_info = 2 [ (google.api .field_behavior ) = OPTIONAL ] ;
822871
823- // Additional local inventory attributes, for example, store name, promotion
824- // tags, etc.
872+ // Optional. Additional local inventory attributes, for example, store name,
873+ // promotion tags, etc.
825874 //
826875 // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
827876 // error is returned:
@@ -838,9 +887,10 @@ message LocalInventory {
838887 // unset or set to false.
839888 // * The max summed total bytes of custom attribute keys and values per
840889 // product is 5MiB.
841- map <string , CustomAttribute > attributes = 3 ;
890+ map <string , CustomAttribute > attributes = 3
891+ [(google.api.field_behavior ) = OPTIONAL ];
842892
843- // Input only . Supported fulfillment types. Valid fulfillment type values
893+ // Optional . Supported fulfillment types. Valid fulfillment type values
844894 // include commonly used types (such as pickup in store and same day
845895 // delivery), and custom types. Customers have to map custom types to their
846896 // display names before rendering UI.
@@ -863,5 +913,22 @@ message LocalInventory {
863913 // All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is
864914 // returned.
865915 repeated string fulfillment_types = 4
866- [(google.api.field_behavior ) = INPUT_ONLY ];
916+ [(google.api.field_behavior ) = OPTIONAL ];
917+ }
918+
919+ // Metadata for pinning to be returned in the response.
920+ // This is used for distinguishing between applied vs dropped pins.
921+ message PinControlMetadata {
922+ // List of product ids which have associated pins.
923+ message ProductPins {
924+ // List of product ids which have associated pins.
925+ repeated string product_id = 1 ;
926+ }
927+
928+ // Map of all matched pins, keyed by pin position.
929+ map <int64 , ProductPins > all_matched_pins = 1 ;
930+
931+ // Map of pins that were dropped due to overlap with other matching pins,
932+ // keyed by pin position.
933+ map <int64 , ProductPins > dropped_pins = 2 ;
867934}
0 commit comments