@@ -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][google.cloud.retail.v2alpha.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.v2alpha.Condition.query_terms]
378+ // (for search only) or
379+ // [Condition.page_categories][google.cloud.retail.v2alpha.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.v2alpha.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.v2alpha.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 //
@@ -794,9 +845,7 @@ message UserInfo {
794845 // is set.
795846 string ip_address = 2 ;
796847
797- // User agent as included in the HTTP header. Required for getting
798- // [SearchResponse.sponsored_results][google.cloud.retail.v2alpha.SearchResponse.sponsored_results].
799- //
848+ // User agent as included in the HTTP header.
800849 // The field must be a UTF-8 encoded string with a length limit of 1,000
801850 // characters. Otherwise, an INVALID_ARGUMENT error is returned.
802851 //
@@ -823,17 +872,63 @@ message UserInfo {
823872// The inventory information at a place (e.g. a store) identified
824873// by a place ID.
825874message LocalInventory {
826- // The place ID for the current set of inventory information.
827- string place_id = 1 ;
875+ // Product availability. If this field is unspecified, the product is
876+ // assumed to be in stock.
877+ enum Availability {
878+ // Default product availability. Default to
879+ // [Availability.IN_STOCK][google.cloud.retail.v2alpha.LocalInventory.Availability.IN_STOCK]
880+ // if unset.
881+ AVAILABILITY_UNSPECIFIED = 0 ;
882+
883+ // Product in stock.
884+ IN_STOCK = 1 ;
885+
886+ // Product out of stock.
887+ OUT_OF_STOCK = 2 ;
888+
889+ // Product that is in pre-order state.
890+ PREORDER = 3 ;
891+
892+ // Product that is back-ordered (i.e. temporarily out of stock).
893+ BACKORDER = 4 ;
894+ }
895+
896+ // Optional. The place ID for the current set of inventory information.
897+ string place_id = 1 [(google.api.field_behavior ) = OPTIONAL ];
828898
829- // Product price and cost information.
899+ // Optional. Product price and cost information.
830900 //
831901 // Google Merchant Center property
832902 // [price](https://support.google.com/merchants/answer/6324371).
833- PriceInfo price_info = 2 ;
903+ PriceInfo price_info = 2 [(google.api.field_behavior ) = OPTIONAL ];
904+
905+ // Optional. The availability of the
906+ // [Product][google.cloud.retail.v2alpha.Product] at this place_id. Default to
907+ // [Availability.IN_STOCK][google.cloud.retail.v2alpha.LocalInventory.Availability.IN_STOCK].
908+ //
909+ // For primary products with variants set the availability of the primary as
910+ // [Availability.OUT_OF_STOCK][google.cloud.retail.v2alpha.LocalInventory.Availability.OUT_OF_STOCK]
911+ // and set the true availability at the variant level. This way the primary
912+ // product will be considered "in stock" as long as it has at least one
913+ // variant in stock.
914+ //
915+ // For primary products with no variants set the true availability at the
916+ // primary level.
917+ //
918+ // Corresponding properties: Google Merchant Center property
919+ // [availability](https://support.google.com/merchants/answer/6324448).
920+ // Schema.org property [Offer.availability](https://schema.org/availability).
921+ //
922+ // This field is currently only used by the Recommendations API. For Search,
923+ // please make use of
924+ // [fulfillment_types][google.cloud.retail.v2alpha.LocalInventory.fulfillment_types]
925+ // or custom attributes for similar behaviour. See [here](
926+ // https://cloud.google.com/retail/docs/local-inventory-updates#local-inventory-update-methods)
927+ // for more details.
928+ Availability availability = 5 [(google.api.field_behavior ) = OPTIONAL ];
834929
835- // Additional local inventory attributes, for example, store name, promotion
836- // tags, etc.
930+ // Optional. Additional local inventory attributes, for example, store name,
931+ // promotion tags, etc.
837932 //
838933 // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
839934 // error is returned:
@@ -850,9 +945,10 @@ message LocalInventory {
850945 // unset or set to false.
851946 // * The max summed total bytes of custom attribute keys and values per
852947 // product is 5MiB.
853- map <string , CustomAttribute > attributes = 3 ;
948+ map <string , CustomAttribute > attributes = 3
949+ [(google.api.field_behavior ) = OPTIONAL ];
854950
855- // Input only . Supported fulfillment types. Valid fulfillment type values
951+ // Optional . Supported fulfillment types. Valid fulfillment type values
856952 // include commonly used types (such as pickup in store and same day
857953 // delivery), and custom types. Customers have to map custom types to their
858954 // display names before rendering UI.
@@ -875,5 +971,22 @@ message LocalInventory {
875971 // All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is
876972 // returned.
877973 repeated string fulfillment_types = 4
878- [(google.api.field_behavior ) = INPUT_ONLY ];
974+ [(google.api.field_behavior ) = OPTIONAL ];
975+ }
976+
977+ // Metadata for pinning to be returned in the response.
978+ // This is used for distinguishing between applied vs dropped pins.
979+ message PinControlMetadata {
980+ // List of product ids which have associated pins.
981+ message ProductPins {
982+ // List of product ids which have associated pins.
983+ repeated string product_id = 1 ;
984+ }
985+
986+ // Map of all matched pins, keyed by pin position.
987+ map <int64 , ProductPins > all_matched_pins = 1 ;
988+
989+ // Map of pins that were dropped due to overlap with other matching pins,
990+ // keyed by pin position.
991+ map <int64 , ProductPins > dropped_pins = 2 ;
879992}
0 commit comments