@@ -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
@@ -369,6 +369,48 @@ message Rule {
369369 repeated string attribute_names = 1 ;
370370 }
371371
372+ // Pins one or more specified products to a specific position in the
373+ // results.
374+ //
375+ // * Rule Condition:
376+ // Must specify non-empty
377+ // [Condition.query_terms][google.cloud.retail.v2beta.Condition.query_terms]
378+ // (for search only) or
379+ // [Condition.page_categories][google.cloud.retail.v2beta.Condition.page_categories]
380+ // (for browse only), but can't specify both.
381+ //
382+ // * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
383+ // uses 1-based indexing).
384+ //
385+ // * Action Result: Will pin products with matching ids to the position
386+ // specified in the final result order.
387+ //
388+ // Example: Suppose the query is `shoes`, the
389+ // [Condition.query_terms][google.cloud.retail.v2beta.Condition.query_terms]
390+ // is `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will
391+ // be pinned to the top position in the final results.
392+ //
393+ // If multiple PinActions are matched to a single request the actions will
394+ // be processed from most to least recently updated.
395+ //
396+ // Pins to positions larger than the max allowed page size of 120 are not
397+ // allowed.
398+ message PinAction {
399+ // Required. A map of positions to product_ids.
400+ //
401+ // Partial matches per action are allowed, if a certain position in the map
402+ // is already filled that `[position, product_id]` pair will be ignored
403+ // but the rest may still be applied. This case will only occur if multiple
404+ // pin actions are matched to a single request, as the map guarantees that
405+ // pin positions are unique within the same action.
406+ //
407+ // Duplicate product_ids are not permitted within a single pin map.
408+ //
409+ // The max size of this map is 120, equivalent to the max [request page
410+ // size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
411+ map <int64 , string > pin_map = 1 [(google.api.field_behavior ) = REQUIRED ];
412+ }
413+
372414 // An action must be provided.
373415 oneof action {
374416 // A boost action.
@@ -401,6 +443,10 @@ message Rule {
401443
402444 // Remove an attribute as a facet in the request (if present).
403445 RemoveFacetAction remove_facet_action = 13 ;
446+
447+ // Pins one or more specified products to a specific position in the
448+ // results.
449+ PinAction pin_action = 14 ;
404450 }
405451
406452 // Required. The condition that triggers the rule.
@@ -445,9 +491,9 @@ message Audience {
445491message ColorInfo {
446492 // The standard color families. Strongly recommended to use the following
447493 // standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple",
448- // "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and
449- // "Mixed". Normally it is expected to have only 1 color family. May consider
450- // using single "Mixed" instead of multiple values.
494+ // "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and "Mixed".
495+ // Normally it is expected to have only 1 color family. May consider using
496+ // single "Mixed" instead of multiple values.
451497 //
452498 // A maximum of 5 values are allowed. Each value must be a UTF-8 encoded
453499 // string with a length limit of 128 characters. Otherwise, an
@@ -456,6 +502,10 @@ message ColorInfo {
456502 // Google Merchant Center property
457503 // [color](https://support.google.com/merchants/answer/6324487). Schema.org
458504 // property [Product.color](https://schema.org/color).
505+ //
506+ // The colorFamilies field as a system attribute is not a required field but
507+ // strongly recommended to be specified. Google Search models treat this field
508+ // as more important than a custom product attribute when specified.
459509 repeated string color_families = 1 ;
460510
461511 // The color display names, which may be different from standard color family
@@ -570,9 +620,10 @@ message FulfillmentInfo {
570620}
571621
572622// [Product][google.cloud.retail.v2beta.Product] image. Recommendations AI and
573- // Retail Search do not use product images to improve prediction and search
574- // results. However, product images can be returned in results, and are shown in
575- // prediction or search previews in the console.
623+ // Retail Search use product images to improve prediction and search results.
624+ // Product images can be returned in results, and are shown in prediction or
625+ // search previews in the console. Please try to provide correct product images
626+ // and avoid using images with size too small.
576627message Image {
577628 // Required. URI of the image.
578629 //
@@ -793,9 +844,7 @@ message UserInfo {
793844 // is set.
794845 string ip_address = 2 ;
795846
796- // User agent as included in the HTTP header. Required for getting
797- // [SearchResponse.sponsored_results][google.cloud.retail.v2beta.SearchResponse.sponsored_results].
798- //
847+ // User agent as included in the HTTP header.
799848 // The field must be a UTF-8 encoded string with a length limit of 1,000
800849 // characters. Otherwise, an INVALID_ARGUMENT error is returned.
801850 //
@@ -822,17 +871,17 @@ message UserInfo {
822871// The inventory information at a place (e.g. a store) identified
823872// by a place ID.
824873message LocalInventory {
825- // The place ID for the current set of inventory information.
826- string place_id = 1 ;
874+ // Optional. The place ID for the current set of inventory information.
875+ string place_id = 1 [ (google.api .field_behavior ) = OPTIONAL ] ;
827876
828- // Product price and cost information.
877+ // Optional. Product price and cost information.
829878 //
830879 // Google Merchant Center property
831880 // [price](https://support.google.com/merchants/answer/6324371).
832- PriceInfo price_info = 2 ;
881+ PriceInfo price_info = 2 [ (google.api .field_behavior ) = OPTIONAL ] ;
833882
834- // Additional local inventory attributes, for example, store name, promotion
835- // tags, etc.
883+ // Optional. Additional local inventory attributes, for example, store name,
884+ // promotion tags, etc.
836885 //
837886 // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
838887 // error is returned:
@@ -849,9 +898,10 @@ message LocalInventory {
849898 // unset or set to false.
850899 // * The max summed total bytes of custom attribute keys and values per
851900 // product is 5MiB.
852- map <string , CustomAttribute > attributes = 3 ;
901+ map <string , CustomAttribute > attributes = 3
902+ [(google.api.field_behavior ) = OPTIONAL ];
853903
854- // Input only . Supported fulfillment types. Valid fulfillment type values
904+ // Optional . Supported fulfillment types. Valid fulfillment type values
855905 // include commonly used types (such as pickup in store and same day
856906 // delivery), and custom types. Customers have to map custom types to their
857907 // display names before rendering UI.
@@ -874,5 +924,22 @@ message LocalInventory {
874924 // All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is
875925 // returned.
876926 repeated string fulfillment_types = 4
877- [(google.api.field_behavior ) = INPUT_ONLY ];
927+ [(google.api.field_behavior ) = OPTIONAL ];
928+ }
929+
930+ // Metadata for pinning to be returned in the response.
931+ // This is used for distinguishing between applied vs dropped pins.
932+ message PinControlMetadata {
933+ // List of product ids which have associated pins.
934+ message ProductPins {
935+ // List of product ids which have associated pins.
936+ repeated string product_id = 1 ;
937+ }
938+
939+ // Map of all matched pins, keyed by pin position.
940+ map <int64 , ProductPins > all_matched_pins = 1 ;
941+
942+ // Map of pins that were dropped due to overlap with other matching pins,
943+ // keyed by pin position.
944+ map <int64 , ProductPins > dropped_pins = 2 ;
878945}
0 commit comments