From 05005ea09accff4d04b152f2fa2bf452f6b9768b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 3 Jun 2022 10:01:02 -0700 Subject: [PATCH] feat: allow users to disable spell check in search requests (#183) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: fix docstring formatting Committer: parthea PiperOrigin-RevId: 449545643 Source-Link: https://github.com/googleapis/googleapis/commit/1bed8a0d6886720c5bfc8ba1076de3db68c23b83 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d4ccc5fc612c260546bcecef2873575688a02d8b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDRjY2M1ZmM2MTJjMjYwNTQ2YmNlY2VmMjg3MzU3NTY4OGEwMmQ4YiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: allow users to disable spell check in search requests feat: allow users to add labels in search requests docs: deprecate indexable/searchable on the product level custom attributes docs: keep the API doc up-to-date with recent changes PiperOrigin-RevId: 452193046 Source-Link: https://github.com/googleapis/googleapis/commit/4e0282f92e4e581b79062063488bf62fa837a905 Source-Link: https://github.com/googleapis/googleapis-gen/commit/3fa3c84e3da8c8e604e129c141367dd0926878f3 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiM2ZhM2M4NGUzZGE4YzhlNjA0ZTEyOWMxNDEzNjdkZDA5MjY4NzhmMyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- protos/google/cloud/retail/v2/catalog.proto | 16 +- protos/google/cloud/retail/v2/common.proto | 36 +- .../cloud/retail/v2/completion_service.proto | 15 +- .../cloud/retail/v2/import_config.proto | 11 +- .../cloud/retail/v2/prediction_service.proto | 16 +- protos/google/cloud/retail/v2/product.proto | 4 +- .../cloud/retail/v2/product_service.proto | 36 +- .../google/cloud/retail/v2/purge_config.proto | 5 +- .../cloud/retail/v2/search_service.proto | 108 ++++-- .../google/cloud/retail/v2/user_event.proto | 9 +- .../google/cloud/retail/v2alpha/catalog.proto | 4 +- .../google/cloud/retail/v2beta/catalog.proto | 4 +- protos/protos.d.ts | 115 ++++++ protos/protos.js | 328 +++++++++++++++++- protos/protos.json | 41 ++- .../v2/completion_service.complete_query.js | 6 +- .../v2/prediction_service.predict.js | 11 +- .../v2/product_service.import_products.js | 10 +- ...oduct_service.remove_fulfillment_places.js | 3 +- .../v2/product_service.update_product.js | 4 + samples/generated/v2/search_service.search.js | 40 ++- ...ippet_metadata.google.cloud.retail.v2.json | 22 +- src/v2/completion_service_client.ts | 6 +- src/v2/prediction_service_client.ts | 12 +- src/v2/product_service_client.ts | 23 +- src/v2/search_service_client.ts | 117 ++++++- 26 files changed, 884 insertions(+), 118 deletions(-) diff --git a/protos/google/cloud/retail/v2/catalog.proto b/protos/google/cloud/retail/v2/catalog.proto index b5de698d..119afaf3 100644 --- a/protos/google/cloud/retail/v2/catalog.proto +++ b/protos/google/cloud/retail/v2/catalog.proto @@ -40,10 +40,10 @@ message ProductLevelConfig { // default to // [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] if // unset. - // * `variant`: You can only ingest - // [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2.Product]s. - // This means + // * `variant` (incompatible with Retail Search): You can only + // ingest + // [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] + // [Product][google.cloud.retail.v2.Product]s. This means // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id] // cannot be empty. // @@ -54,8 +54,8 @@ message ProductLevelConfig { // [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field] // is `itemGroupId`, an INVALID_ARGUMENT error is returned. // - // See [Using product - // levels](https://cloud.google.com/retail/recommendations-ai/docs/catalog#product-levels) + // See [Product + // levels](https://cloud.google.com/retail/docs/catalog#product-levels) // for more details. string ingestion_product_type = 1; @@ -76,8 +76,8 @@ message ProductLevelConfig { // [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type] // is `variant`, an INVALID_ARGUMENT error is returned. // - // See [Using product - // levels](https://cloud.google.com/retail/recommendations-ai/docs/catalog#product-levels) + // See [Product + // levels](https://cloud.google.com/retail/docs/catalog#product-levels) // for more details. string merchant_center_product_id_field = 2; } diff --git a/protos/google/cloud/retail/v2/common.proto b/protos/google/cloud/retail/v2/common.proto index 733b8cca..386a9aa6 100644 --- a/protos/google/cloud/retail/v2/common.proto +++ b/protos/google/cloud/retail/v2/common.proto @@ -115,24 +115,29 @@ message CustomAttribute { // Otherwise, an INVALID_ARGUMENT error is returned. repeated double numbers = 2; - // This field will only be used when + // This field is normally ignored unless // [AttributesConfig.attribute_config_level][] of the - // [Catalog][google.cloud.retail.v2.Catalog] is - // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG', if true, custom attribute values are - // searchable by text queries in + // [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated + // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level + // attribute configuration, see [Configuration + // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). + // If true, custom attribute values are searchable by text queries in // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. // // This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent]. // // Only set if type [text][google.cloud.retail.v2.CustomAttribute.text] is // set. Otherwise, a INVALID_ARGUMENT error is returned. - optional bool searchable = 3; + optional bool searchable = 3 [deprecated = true]; - // This field will only be used when + // This field is normally ignored unless // [AttributesConfig.attribute_config_level][] of the - // [Catalog][google.cloud.retail.v2.Catalog] is - // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG', if true, custom attribute values are - // indexed, so that it can be filtered, faceted or boosted in + // [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated + // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level + // attribute configuration, see [Configuration + // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). + // If true, custom attribute values are indexed, so that they can be filtered, + // faceted or boosted in // [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. // // This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent]. @@ -142,7 +147,7 @@ message CustomAttribute { // and // [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec] // for more details. - optional bool indexable = 4; + optional bool indexable = 4 [deprecated = true]; } // Fulfillment information, such as the store IDs for in-store pickup or region @@ -284,7 +289,10 @@ message PriceInfo { float price = 2; // Price of the product without any discount. If zero, by default set to be - // the [price][google.cloud.retail.v2.PriceInfo.price]. + // the [price][google.cloud.retail.v2.PriceInfo.price]. If set, + // [original_price][google.cloud.retail.v2.PriceInfo.original_price] should be + // greater than or equal to [price][google.cloud.retail.v2.PriceInfo.price], + // otherwise an INVALID_ARGUMENT error is thrown. float original_price = 3; // The costs associated with the sale of a particular product. Used for gross @@ -368,10 +376,14 @@ message Rating { // Information of an end user. message UserInfo { // Highly recommended for logged-in users. Unique identifier for logged-in - // user, such as a user name. + // user, such as a user name. Don't set for anonymous users. // // Always use a hashed value for this ID. // + // Don't set the field to the same fixed ID for different users. This mixes + // the event history of those users together, which results in degraded + // model quality. + // // The field must be a UTF-8 encoded string with a length limit of 128 // characters. Otherwise, an INVALID_ARGUMENT error is returned. string user_id = 1; diff --git a/protos/google/cloud/retail/v2/completion_service.proto b/protos/google/cloud/retail/v2/completion_service.proto index 5e7e9a6c..68306218 100644 --- a/protos/google/cloud/retail/v2/completion_service.proto +++ b/protos/google/cloud/retail/v2/completion_service.proto @@ -133,9 +133,9 @@ message CompleteQueryRequest { // // * user-data // - // * cloud-retail - // This option requires additional allowlisting. Before using cloud-retail, - // contact Cloud Retail support team first. + // * cloud-retail: + // This option requires enabling auto-learning function first. See + // [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). string dataset = 6; // Completion max suggestions. If left unset or set to 0, then will fallback @@ -154,10 +154,13 @@ message CompleteQueryResponse { string suggestion = 1; // Custom attributes for the suggestion term. + // // * For "user-data", the attributes are additional custom attributes // ingested through BigQuery. + // // * For "cloud-retail", the attributes are product attributes generated - // by Cloud Retail. + // by Cloud Retail. This is an experimental feature. Contact Retail Search + // support team if you are interested in enabling it. map attributes = 2; } @@ -185,11 +188,15 @@ message CompleteQueryResponse { // [CompleteQueryRequest.visitor_id][google.cloud.retail.v2.CompleteQueryRequest.visitor_id] // field is set and [UserEvent][google.cloud.retail.v2.UserEvent] is imported. // The recent searches satisfy the follow rules: + // // * They are ordered from latest to oldest. + // // * They are matched with // [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query] // case insensitively. + // // * They are transformed to lower cases. + // // * They are UTF-8 safe. // // Recent searches are deduplicated. More recent searches will be reserved diff --git a/protos/google/cloud/retail/v2/import_config.proto b/protos/google/cloud/retail/v2/import_config.proto index 74cec22a..cadec119 100644 --- a/protos/google/cloud/retail/v2/import_config.proto +++ b/protos/google/cloud/retail/v2/import_config.proto @@ -214,11 +214,18 @@ message ImportProductsRequest { // [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. ReconciliationMode reconciliation_mode = 5; - // Pub/Sub topic for receiving notification. If this field is set, + // Full Pub/Sub topic name for receiving notification. If this field is set, // when the import is finished, a notification will be sent to // specified Pub/Sub topic. The message data will be JSON string of a // [Operation][google.longrunning.Operation]. - // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + // + // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + // to be within the same project as + // [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent]. + // Make sure that both + // `cloud-retail-customer-data-access@system.gserviceaccount.com` and + // `service-@gcp-sa-retail.iam.gserviceaccount.com` + // have the `pubsub.topics.publish` IAM permission on the topic. // // Only supported when // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode] diff --git a/protos/google/cloud/retail/v2/prediction_service.proto b/protos/google/cloud/retail/v2/prediction_service.proto index 061db142..f1f1b4e1 100644 --- a/protos/google/cloud/retail/v2/prediction_service.proto +++ b/protos/google/cloud/retail/v2/prediction_service.proto @@ -63,6 +63,16 @@ message PredictRequest { // they took to trigger the predict request. Note that this user event detail // won't be ingested to userEvent logs. Thus, a separate userEvent write // request is required for event logging. + // + // Don't set + // [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or + // [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same + // fixed ID for different users. If you are trying to receive non-personalized + // recommendations (not recommended; this can negatively impact model + // performance), instead set + // [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a + // random unique ID and leave + // [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED]; // Maximum number of results to return per page. Set this property @@ -143,7 +153,7 @@ message PredictRequest { // * Each resource can have multiple labels, up to a maximum of 64. // * Each label must be a key-value pair. // * Keys have a minimum length of 1 character and a maximum length of 63 - // characters, and cannot be empty. Values can be empty, and have a maximum + // characters and cannot be empty. Values can be empty and have a maximum // length of 63 characters. // * Keys and values can contain only lowercase letters, numeric characters, // underscores, and dashes. All characters must use UTF-8 encoding, and @@ -169,9 +179,9 @@ message PredictResponse { // // Possible values: // - // * `product`: JSON representation of the product. Will be set if + // * `product`: JSON representation of the product. Is set if // `returnProduct` is set to true in `PredictRequest.params`. - // * `score`: Prediction score in double value. Will be set if + // * `score`: Prediction score in double value. Is set if // `returnScore` is set to true in `PredictRequest.params`. map metadata = 2; } diff --git a/protos/google/cloud/retail/v2/product.proto b/protos/google/cloud/retail/v2/product.proto index ea861fb6..43443295 100644 --- a/protos/google/cloud/retail/v2/product.proto +++ b/protos/google/cloud/retail/v2/product.proto @@ -536,11 +536,11 @@ message Product { // * [name][google.cloud.retail.v2.Product.name] // * [color_info][google.cloud.retail.v2.Product.color_info] // - // Maximum number of paths is 30. Otherwise, an INVALID_ARGUMENT error is + // The maximum number of paths is 30. Otherwise, an INVALID_ARGUMENT error is // returned. // // Note: Returning more fields in - // [SearchResponse][google.cloud.retail.v2.SearchResponse] may increase + // [SearchResponse][google.cloud.retail.v2.SearchResponse] can increase // response payload size and serving latency. google.protobuf.FieldMask retrievable_fields = 30; diff --git a/protos/google/cloud/retail/v2/product_service.proto b/protos/google/cloud/retail/v2/product_service.proto index 71319834..ba8d8d18 100644 --- a/protos/google/cloud/retail/v2/product_service.proto +++ b/protos/google/cloud/retail/v2/product_service.proto @@ -88,7 +88,7 @@ service ProductService { // Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. // - // Request processing may be synchronous. No partial updating is supported. + // Request processing may be synchronous. // Non-existing items are created. // // Note that it is possible for a subset of the @@ -139,7 +139,7 @@ service ProductService { // // Pre-existing inventory information can only be updated with // [SetInventory][google.cloud.retail.v2.ProductService.SetInventory], - // [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], + // [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], // and // [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. // @@ -345,6 +345,11 @@ message UpdateProductRequest { // // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error // is returned. + // + // The attribute key can be updated by setting the mask path as + // "attributes.${key_name}". If a key name is present in the mask but not in + // the patching product from the request, this key will be deleted after the + // update. google.protobuf.FieldMask update_mask = 2; // If set to true, and the [Product][google.cloud.retail.v2.Product] is not @@ -572,7 +577,9 @@ message SetInventoryMetadata {} // method. message SetInventoryResponse {} -// Request message for [AddFulfillmentPlaces][] method. +// Request message for +// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces] +// method. message AddFulfillmentPlacesRequest { // Required. Full resource name of [Product][google.cloud.retail.v2.Product], // such as @@ -640,15 +647,19 @@ message AddFulfillmentPlacesRequest { // Metadata related to the progress of the AddFulfillmentPlaces operation. // Currently empty because there is no meaningful metadata populated from the -// [AddFulfillmentPlaces][] method. +// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces] +// method. message AddFulfillmentPlacesMetadata {} // Response of the AddFulfillmentPlacesRequest. Currently empty because -// there is no meaningful response populated from the [AddFulfillmentPlaces][] +// there is no meaningful response populated from the +// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces] // method. message AddFulfillmentPlacesResponse {} -// Request message for [AddLocalInventories][] method. +// Request message for +// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] +// method. message AddLocalInventoriesRequest { // Required. Full resource name of [Product][google.cloud.retail.v2.Product], // such as @@ -700,11 +711,15 @@ message AddLocalInventoriesRequest { // Metadata related to the progress of the AddLocalInventories operation. // Currently empty because there is no meaningful metadata populated from the -// [AddLocalInventories][] method. +// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] +// method. message AddLocalInventoriesMetadata {} -// Response of the [AddLocalInventories][] API. Currently empty because -// there is no meaningful response populated from the [AddLocalInventories][] +// Response of the +// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] +// API. Currently empty because there is no meaningful response populated from +// the +// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] // method. message AddLocalInventoriesResponse {} @@ -782,7 +797,8 @@ message RemoveFulfillmentPlacesRequest { // If this field is set to an invalid value other than these, an // INVALID_ARGUMENT error is returned. // - // This field directly corresponds to [Product.fulfillment_info.type][]. + // This field directly corresponds to + // [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type]. string type = 2 [(google.api.field_behavior) = REQUIRED]; // Required. The IDs for this diff --git a/protos/google/cloud/retail/v2/purge_config.proto b/protos/google/cloud/retail/v2/purge_config.proto index 6c8d54c7..cb510745 100644 --- a/protos/google/cloud/retail/v2/purge_config.proto +++ b/protos/google/cloud/retail/v2/purge_config.proto @@ -37,7 +37,10 @@ message PurgeUserEventsRequest { // Required. The resource name of the catalog under which the events are // created. The format is // `projects/${projectId}/locations/global/catalogs/${catalogId}` - string parent = 1 [(google.api.field_behavior) = REQUIRED]; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } + ]; // Required. The filter string to specify the events to be deleted with a // length limit of 5,000 characters. Empty string filter is not allowed. The diff --git a/protos/google/cloud/retail/v2/search_service.proto b/protos/google/cloud/retail/v2/search_service.proto index ec8750ae..82242742 100644 --- a/protos/google/cloud/retail/v2/search_service.proto +++ b/protos/google/cloud/retail/v2/search_service.proto @@ -113,8 +113,8 @@ message SearchRequest { // Only get facet for the given restricted values. For example, when using // "pickupInStore" as key and set restricted values to // ["store123", "store456"], only facets for "store123" and "store456" are - // returned. Only supported on textual fields and fulfillments. - // Maximum is 20. + // returned. Only supported on predefined textual fields, custom textual + // attributes and fulfillments. Maximum is 20. // // Must be set for the fulfillment facet keys: // @@ -206,19 +206,29 @@ message SearchRequest { // List of keys to exclude when faceting. // + // // By default, // [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key] // is not excluded from the filter unless it is listed in this field. // - // For example, suppose there are 100 products with color facet "Red" and - // 200 products with color facet "Blue". A query containing the filter - // "colorFamilies:ANY("Red")" and have "colorFamilies" as + // Listing a facet key in this field allows its values to appear as facet + // results, even when they are filtered out of search results. Using this + // field does not affect what search results are returned. + // + // For example, suppose there are 100 products with the color facet "Red" + // and 200 products with the color facet "Blue". A query containing the + // filter "colorFamilies:ANY("Red")" and having "colorFamilies" as // [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key] - // will by default return the "Red" with count 100. + // would by default return only "Red" products in the search results, and + // also return "Red" with count 100 as the only color facet. Although there + // are also blue products available, "Blue" would not be shown as an + // available facet value. // - // If this field contains "colorFamilies", then the query returns both the - // "Red" with count 100 and "Blue" with count 200, because the - // "colorFamilies" key is now excluded from the filter. + // If "colorFamilies" is listed in "excludedFilterKeys", then the query + // returns the facet values "Red" with count 100 and "Blue" with count + // 200, because the "colorFamilies" key is now excluded from the filter. + // Because this field doesn't affect search results, the search results + // are still correctly filtered to return only "Red" products. // // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error // is returned. @@ -317,7 +327,7 @@ message SearchRequest { // Condition boost specifications. If a product matches multiple conditions // in the specifictions, boost scores from these specifications are all // applied and combined in a non-linear way. Maximum number of - // specifications is 10. + // specifications is 20. repeated ConditionBoostSpec condition_boost_specs = 1; // Whether to skip boostspec validation. If this field is set to true, @@ -377,6 +387,31 @@ message SearchRequest { Mode mode = 1; } + // The specification for query spell correction. + message SpellCorrectionSpec { + // Enum describing under which mode spell correction should occur. + enum Mode { + // Unspecified spell correction mode. This defaults to + // [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. + MODE_UNSPECIFIED = 0; + + // Google Retail Search will try to find a spell suggestion if there + // is any and put in the + // [SearchResponse.corrected_query][google.cloud.retail.v2.SearchResponse.corrected_query]. + // The spell suggestion will not be used as the search query. + SUGGESTION_ONLY = 1; + + // Automatic spell correction built by Google Retail Search. Search will + // be based on the corrected query if found. + AUTO = 2; + } + + // The mode under which spell correction should take effect to + // replace the original search query. Default to + // [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. + Mode mode = 1; + } + // The search mode of each search request. enum SearchMode { // Default value. In this case both product search and faceted search will @@ -398,7 +433,9 @@ message SearchRequest { // Only faceted search will be performed. The product search will be // disabled. // - // When in this mode, one or both of [SearchRequest.facet_spec][] and + // When in this mode, one or both of + // [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs] + // and // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec] // should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only // [SearchResponse.Facet] will be returned. [SearchResponse.SearchResult] @@ -407,7 +444,7 @@ message SearchRequest { } // Required. The resource name of the search engine placement, such as - // `projects/*/locations/global/catalogs/default_catalog/placements/default_search` + // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. // This field is used to identify the serving configuration name and the set // of models that will be used to make the search. string placement = 1 [(google.api.field_behavior) = REQUIRED]; @@ -422,6 +459,11 @@ message SearchRequest { ]; // Raw search query. + // + // If this field is empty, the request is considered a category browsing + // request and returned results are based on + // [filter][google.cloud.retail.v2.SearchRequest.filter] and + // [page_categories][google.cloud.retail.v2.SearchRequest.page_categories]. string query = 3; // Required. A unique identifier for tracking visitors. For example, this @@ -515,10 +557,10 @@ message SearchRequest { // [user guide](https://cloud.google.com/retail/docs/boosting). // // Notice that if both [ServingConfig.boost_control_ids][] and - // [SearchRequest.boost_spec] are set, the boost conditions from both places - // are evaluated. If a search request matches multiple boost conditions, - // the final boost score is equal to the sum of the boost scores from all - // matched boost conditions. + // [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec] + // are set, the boost conditions from both places are evaluated. If a search + // request matches multiple boost conditions, the final boost score is equal + // to the sum of the boost scores from all matched boost conditions. BoostSpec boost_spec = 13; // The query expansion specification that specifies the conditions under which @@ -553,7 +595,8 @@ message SearchRequest { // * inventory(place_id,price) // * inventory(place_id,original_price) // * inventory(place_id,attributes.key), where key is any key in the - // [Product.inventories.attributes][] map. + // [Product.local_inventories.attributes][google.cloud.retail.v2.LocalInventory.attributes] + // map. // * attributes.key, where key is any key in the // [Product.attributes][google.cloud.retail.v2.Product.attributes] map. // * pickupInStore.id, where id is any @@ -617,6 +660,29 @@ message SearchRequest { // The specification for personalization. PersonalizationSpec personalization_spec = 32; + + // The labels applied to a resource must meet the following requirements: + // + // * Each resource can have multiple labels, up to a maximum of 64. + // * Each label must be a key-value pair. + // * Keys have a minimum length of 1 character and a maximum length of 63 + // characters and cannot be empty. Values can be empty and have a maximum + // length of 63 characters. + // * Keys and values can contain only lowercase letters, numeric characters, + // underscores, and dashes. All characters must use UTF-8 encoding, and + // international characters are allowed. + // * The key portion of a label must be unique. However, you can use the same + // key with multiple resources. + // * Keys must start with a lowercase letter or international character. + // + // See [Google Cloud + // Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + // for more details. + map labels = 34; + + // The spell correction specification that specifies the mode under + // which spell correction will take effect. + optional SpellCorrectionSpec spell_correction_spec = 35; } // Response message for @@ -750,7 +816,9 @@ message SearchResponse { // matches. int32 total_size = 3; - // If spell correction applies, the corrected query. Otherwise, empty. + // Contains the spell corrected query, if found. If the spell correction type + // is AUTOMATIC, then the search results are based on corrected_query. + // Otherwise the original query will be used for search. string corrected_query = 4; // A unique search token. This should be included in the @@ -768,10 +836,10 @@ message SearchResponse { QueryExpansionInfo query_expansion_info = 7; // The URI of a customer-defined redirect page. If redirect action is - // triggered, no search will be performed, and only + // triggered, no search is performed, and only // [redirect_uri][google.cloud.retail.v2.SearchResponse.redirect_uri] and // [attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token] - // will be set in the response. + // are set in the response. string redirect_uri = 10; // The fully qualified resource name of applied diff --git a/protos/google/cloud/retail/v2/user_event.proto b/protos/google/cloud/retail/v2/user_event.proto index 8e21f8aa..fc315f88 100644 --- a/protos/google/cloud/retail/v2/user_event.proto +++ b/protos/google/cloud/retail/v2/user_event.proto @@ -54,11 +54,15 @@ message UserEvent { // able to uniquely identify a visitor on a single device. This unique // identifier should not change if the visitor log in/out of the website. // + // Don't set the field to the same fixed ID for different users. This mixes + // the event history of those users together, which results in degraded model + // quality. + // // The field must be a UTF-8 encoded string with a length limit of 128 // characters. Otherwise, an INVALID_ARGUMENT error is returned. // // The field should not contain PII or user-data. We recommend to use Google - // Analystics [Client + // Analytics [Client // ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) // for this field. string visitor_id = 2 [(google.api.field_behavior) = REQUIRED]; @@ -111,12 +115,11 @@ message UserEvent { // The main product details related to the event. // - // This field is required for the following event types: + // This field is optional except for the following event types: // // * `add-to-cart` // * `detail-page-view` // * `purchase-complete` - // * `search` // // In a `search` event, this field represents the products returned to the end // user on the current page (the end user may have not finished browsing the diff --git a/protos/google/cloud/retail/v2alpha/catalog.proto b/protos/google/cloud/retail/v2alpha/catalog.proto index 8dcb23f6..9b3d8cb0 100644 --- a/protos/google/cloud/retail/v2alpha/catalog.proto +++ b/protos/google/cloud/retail/v2alpha/catalog.proto @@ -204,7 +204,7 @@ message AttributesConfig { }; // Required. Immutable. The fully qualified resource name of the attribute - // config. Format: "projects/*/locations/*/catalogs/*/attributesConfig" + // config. Format: `projects/*/locations/*/catalogs/*/attributesConfig` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = IMMUTABLE @@ -237,7 +237,7 @@ message CompletionConfig { }; // Required. Immutable. Fully qualified name - // projects/*/locations/*/catalogs/*/completionConfig + // `projects/*/locations/*/catalogs/*/completionConfig` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = IMMUTABLE diff --git a/protos/google/cloud/retail/v2beta/catalog.proto b/protos/google/cloud/retail/v2beta/catalog.proto index e6d768f5..e0b844ef 100644 --- a/protos/google/cloud/retail/v2beta/catalog.proto +++ b/protos/google/cloud/retail/v2beta/catalog.proto @@ -204,7 +204,7 @@ message AttributesConfig { }; // Required. Immutable. The fully qualified resource name of the attribute - // config. Format: "projects/*/locations/*/catalogs/*/attributesConfig" + // config. Format: `projects/*/locations/*/catalogs/*/attributesConfig` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = IMMUTABLE @@ -237,7 +237,7 @@ message CompletionConfig { }; // Required. Immutable. Fully qualified name - // projects/*/locations/*/catalogs/*/completionConfig + // `projects/*/locations/*/catalogs/*/completionConfig` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.field_behavior) = IMMUTABLE diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 2e6a9dfa..d535c5a5 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -8131,6 +8131,12 @@ export namespace google { /** SearchRequest personalizationSpec */ personalizationSpec?: (google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null); + + /** SearchRequest labels */ + labels?: ({ [k: string]: string }|null); + + /** SearchRequest spellCorrectionSpec */ + spellCorrectionSpec?: (google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null); } /** Represents a SearchRequest. */ @@ -8199,6 +8205,15 @@ export namespace google { /** SearchRequest personalizationSpec. */ public personalizationSpec?: (google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null); + /** SearchRequest labels. */ + public labels: { [k: string]: string }; + + /** SearchRequest spellCorrectionSpec. */ + public spellCorrectionSpec?: (google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null); + + /** SearchRequest _spellCorrectionSpec. */ + public _spellCorrectionSpec?: "spellCorrectionSpec"; + /** * Creates a new SearchRequest instance using the specified properties. * @param [properties] Properties to set @@ -9013,6 +9028,106 @@ export namespace google { } } + /** Properties of a SpellCorrectionSpec. */ + interface ISpellCorrectionSpec { + + /** SpellCorrectionSpec mode */ + mode?: (google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|null); + } + + /** Represents a SpellCorrectionSpec. */ + class SpellCorrectionSpec implements ISpellCorrectionSpec { + + /** + * Constructs a new SpellCorrectionSpec. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec); + + /** SpellCorrectionSpec mode. */ + public mode: (google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|keyof typeof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode); + + /** + * Creates a new SpellCorrectionSpec instance using the specified properties. + * @param [properties] Properties to set + * @returns SpellCorrectionSpec instance + */ + public static create(properties?: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; + + /** + * Encodes the specified SpellCorrectionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @param message SpellCorrectionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpellCorrectionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @param message SpellCorrectionSpec message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; + + /** + * Verifies a SpellCorrectionSpec message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SpellCorrectionSpec message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpellCorrectionSpec + */ + public static fromObject(object: { [k: string]: any }): google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec; + + /** + * Creates a plain object from a SpellCorrectionSpec message. Also converts values to other types if specified. + * @param message SpellCorrectionSpec + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SpellCorrectionSpec to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SpellCorrectionSpec { + + /** Mode enum. */ + enum Mode { + MODE_UNSPECIFIED = 0, + SUGGESTION_ONLY = 1, + AUTO = 2 + } + } + /** SearchMode enum. */ enum SearchMode { SEARCH_MODE_UNSPECIFIED = 0, diff --git a/protos/protos.js b/protos/protos.js index 6fbed5b5..a3d00834 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -19705,6 +19705,8 @@ * @property {Array.|null} [pageCategories] SearchRequest pageCategories * @property {google.cloud.retail.v2.SearchRequest.SearchMode|null} [searchMode] SearchRequest searchMode * @property {google.cloud.retail.v2.SearchRequest.IPersonalizationSpec|null} [personalizationSpec] SearchRequest personalizationSpec + * @property {Object.|null} [labels] SearchRequest labels + * @property {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null} [spellCorrectionSpec] SearchRequest spellCorrectionSpec */ /** @@ -19719,6 +19721,7 @@ this.facetSpecs = []; this.variantRollupKeys = []; this.pageCategories = []; + this.labels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19877,6 +19880,36 @@ */ SearchRequest.prototype.personalizationSpec = null; + /** + * SearchRequest labels. + * @member {Object.} labels + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.labels = $util.emptyObject; + + /** + * SearchRequest spellCorrectionSpec. + * @member {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec|null|undefined} spellCorrectionSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + SearchRequest.prototype.spellCorrectionSpec = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SearchRequest _spellCorrectionSpec. + * @member {"spellCorrectionSpec"|undefined} _spellCorrectionSpec + * @memberof google.cloud.retail.v2.SearchRequest + * @instance + */ + Object.defineProperty(SearchRequest.prototype, "_spellCorrectionSpec", { + get: $util.oneOfGetter($oneOfFields = ["spellCorrectionSpec"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new SearchRequest instance using the specified properties. * @function create @@ -19942,6 +19975,11 @@ writer.uint32(/* id 31, wireType 0 =*/248).int32(message.searchMode); if (message.personalizationSpec != null && Object.hasOwnProperty.call(message, "personalizationSpec")) $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.encode(message.personalizationSpec, writer.uint32(/* id 32, wireType 2 =*/258).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 34, wireType 2 =*/274).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.spellCorrectionSpec != null && Object.hasOwnProperty.call(message, "spellCorrectionSpec")) + $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.encode(message.spellCorrectionSpec, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); return writer; }; @@ -19972,7 +20010,7 @@ SearchRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -20039,6 +20077,31 @@ case 32: message.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.decode(reader, reader.uint32()); break; + case 34: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + case 35: + message.spellCorrectionSpec = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -20074,6 +20137,7 @@ SearchRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.placement != null && message.hasOwnProperty("placement")) if (!$util.isString(message.placement)) return "placement: string expected"; @@ -20161,6 +20225,22 @@ if (error) return "personalizationSpec." + error; } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.spellCorrectionSpec != null && message.hasOwnProperty("spellCorrectionSpec")) { + properties._spellCorrectionSpec = 1; + { + var error = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify(message.spellCorrectionSpec); + if (error) + return "spellCorrectionSpec." + error; + } + } return null; }; @@ -20259,6 +20339,18 @@ throw TypeError(".google.cloud.retail.v2.SearchRequest.personalizationSpec: object expected"); message.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.fromObject(object.personalizationSpec); } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.spellCorrectionSpec != null) { + if (typeof object.spellCorrectionSpec !== "object") + throw TypeError(".google.cloud.retail.v2.SearchRequest.spellCorrectionSpec: object expected"); + message.spellCorrectionSpec = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.fromObject(object.spellCorrectionSpec); + } return message; }; @@ -20280,6 +20372,8 @@ object.variantRollupKeys = []; object.pageCategories = []; } + if (options.objects || options.defaults) + object.labels = {}; if (options.defaults) { object.placement = ""; object.branch = ""; @@ -20345,6 +20439,17 @@ object.searchMode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SearchMode[message.searchMode] : message.searchMode; if (message.personalizationSpec != null && message.hasOwnProperty("personalizationSpec")) object.personalizationSpec = $root.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.toObject(message.personalizationSpec, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.spellCorrectionSpec != null && message.hasOwnProperty("spellCorrectionSpec")) { + object.spellCorrectionSpec = $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.toObject(message.spellCorrectionSpec, options); + if (options.oneofs) + object._spellCorrectionSpec = "spellCorrectionSpec"; + } return object; }; @@ -22171,6 +22276,227 @@ return PersonalizationSpec; })(); + SearchRequest.SpellCorrectionSpec = (function() { + + /** + * Properties of a SpellCorrectionSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @interface ISpellCorrectionSpec + * @property {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode|null} [mode] SpellCorrectionSpec mode + */ + + /** + * Constructs a new SpellCorrectionSpec. + * @memberof google.cloud.retail.v2.SearchRequest + * @classdesc Represents a SpellCorrectionSpec. + * @implements ISpellCorrectionSpec + * @constructor + * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec=} [properties] Properties to set + */ + function SpellCorrectionSpec(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SpellCorrectionSpec mode. + * @member {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode} mode + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @instance + */ + SpellCorrectionSpec.prototype.mode = 0; + + /** + * Creates a new SpellCorrectionSpec instance using the specified properties. + * @function create + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec=} [properties] Properties to set + * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec instance + */ + SpellCorrectionSpec.create = function create(properties) { + return new SpellCorrectionSpec(properties); + }; + + /** + * Encodes the specified SpellCorrectionSpec message. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @function encode + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec} message SpellCorrectionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpellCorrectionSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified SpellCorrectionSpec message, length delimited. Does not implicitly {@link google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.ISpellCorrectionSpec} message SpellCorrectionSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpellCorrectionSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpellCorrectionSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpellCorrectionSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpellCorrectionSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpellCorrectionSpec message. + * @function verify + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpellCorrectionSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a SpellCorrectionSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} SpellCorrectionSpec + */ + SpellCorrectionSpec.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec) + return object; + var message = new $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec(); + switch (object.mode) { + case "MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "SUGGESTION_ONLY": + case 1: + message.mode = 1; + break; + case "AUTO": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a SpellCorrectionSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @static + * @param {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} message SpellCorrectionSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpellCorrectionSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.mode = options.enums === String ? "MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this SpellCorrectionSpec to JSON. + * @function toJSON + * @memberof google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec + * @instance + * @returns {Object.} JSON object + */ + SpellCorrectionSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Mode enum. + * @name google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode + * @enum {number} + * @property {number} MODE_UNSPECIFIED=0 MODE_UNSPECIFIED value + * @property {number} SUGGESTION_ONLY=1 SUGGESTION_ONLY value + * @property {number} AUTO=2 AUTO value + */ + SpellCorrectionSpec.Mode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SUGGESTION_ONLY"] = 1; + values[valuesById[2] = "AUTO"] = 2; + return values; + })(); + + return SpellCorrectionSpec; + })(); + /** * SearchMode enum. * @name google.cloud.retail.v2.SearchRequest.SearchMode diff --git a/protos/protos.json b/protos/protos.json index daf9f12a..9454ba85 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -305,6 +305,7 @@ "type": "bool", "id": 3, "options": { + "deprecated": true, "proto3_optional": true } }, @@ -312,6 +313,7 @@ "type": "bool", "id": 4, "options": { + "deprecated": true, "proto3_optional": true } } @@ -2007,7 +2009,8 @@ "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "retail.googleapis.com/Catalog" } }, "filter": { @@ -2056,6 +2059,13 @@ } }, "SearchRequest": { + "oneofs": { + "_spellCorrectionSpec": { + "oneof": [ + "spellCorrectionSpec" + ] + } + }, "fields": { "placement": { "type": "string", @@ -2147,6 +2157,18 @@ "personalizationSpec": { "type": "PersonalizationSpec", "id": 32 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 34 + }, + "spellCorrectionSpec": { + "type": "SpellCorrectionSpec", + "id": 35, + "options": { + "proto3_optional": true + } } }, "nested": { @@ -2307,6 +2329,23 @@ } } }, + "SpellCorrectionSpec": { + "fields": { + "mode": { + "type": "Mode", + "id": 1 + } + }, + "nested": { + "Mode": { + "values": { + "MODE_UNSPECIFIED": 0, + "SUGGESTION_ONLY": 1, + "AUTO": 2 + } + } + } + }, "SearchMode": { "values": { "SEARCH_MODE_UNSPECIFIED": 0, diff --git a/samples/generated/v2/completion_service.complete_query.js b/samples/generated/v2/completion_service.complete_query.js index 738d1b40..51c1efcd 100644 --- a/samples/generated/v2/completion_service.complete_query.js +++ b/samples/generated/v2/completion_service.complete_query.js @@ -74,9 +74,9 @@ function main(catalog, query) { * events. If leave empty, it will use the "user-data". * Current supported values: * * user-data - * * cloud-retail - * This option requires additional allowlisting. Before using cloud-retail, - * contact Cloud Retail support team first. + * * cloud-retail: + * This option requires enabling auto-learning function first. See + * guidelines (https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). */ // const dataset = 'abc123' /** diff --git a/samples/generated/v2/prediction_service.predict.js b/samples/generated/v2/prediction_service.predict.js index af3de619..d2db6c72 100644 --- a/samples/generated/v2/prediction_service.predict.js +++ b/samples/generated/v2/prediction_service.predict.js @@ -41,6 +41,15 @@ function main(placement, userEvent) { * they took to trigger the predict request. Note that this user event detail * won't be ingested to userEvent logs. Thus, a separate userEvent write * request is required for event logging. + * Don't set + * UserEvent.visitor_id google.cloud.retail.v2.UserEvent.visitor_id or + * UserInfo.user_id google.cloud.retail.v2.UserInfo.user_id to the same + * fixed ID for different users. If you are trying to receive non-personalized + * recommendations (not recommended; this can negatively impact model + * performance), instead set + * UserEvent.visitor_id google.cloud.retail.v2.UserEvent.visitor_id to a + * random unique ID and leave + * UserInfo.user_id google.cloud.retail.v2.UserInfo.user_id unset. */ // const userEvent = {} /** @@ -118,7 +127,7 @@ function main(placement, userEvent) { * * Each resource can have multiple labels, up to a maximum of 64. * * Each label must be a key-value pair. * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters, and cannot be empty. Values can be empty, and have a maximum + * characters and cannot be empty. Values can be empty and have a maximum * length of 63 characters. * * Keys and values can contain only lowercase letters, numeric characters, * underscores, and dashes. All characters must use UTF-8 encoding, and diff --git a/samples/generated/v2/product_service.import_products.js b/samples/generated/v2/product_service.import_products.js index 39cc5522..3de37997 100644 --- a/samples/generated/v2/product_service.import_products.js +++ b/samples/generated/v2/product_service.import_products.js @@ -52,11 +52,17 @@ function main(parent, inputConfig) { */ // const reconciliationMode = {} /** - * Pub/Sub topic for receiving notification. If this field is set, + * Full Pub/Sub topic name for receiving notification. If this field is set, * when the import is finished, a notification will be sent to * specified Pub/Sub topic. The message data will be JSON string of a * Operation google.longrunning.Operation. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + * to be within the same project as + * ImportProductsRequest.parent google.cloud.retail.v2.ImportProductsRequest.parent. + * Make sure that both + * `cloud-retail-customer-data-access@system.gserviceaccount.com` and + * `service-@gcp-sa-retail.iam.gserviceaccount.com` + * have the `pubsub.topics.publish` IAM permission on the topic. * Only supported when * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode * is set to `FULL`. diff --git a/samples/generated/v2/product_service.remove_fulfillment_places.js b/samples/generated/v2/product_service.remove_fulfillment_places.js index 3be188b8..8824fefa 100644 --- a/samples/generated/v2/product_service.remove_fulfillment_places.js +++ b/samples/generated/v2/product_service.remove_fulfillment_places.js @@ -49,7 +49,8 @@ function main(product, type, placeIds) { * * "custom-type-5" * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. - * This field directly corresponds to Product.fulfillment_info.type . + * This field directly corresponds to + * Product.fulfillment_info.type google.cloud.retail.v2.FulfillmentInfo.type. */ // const type = 'abc123' /** diff --git a/samples/generated/v2/product_service.update_product.js b/samples/generated/v2/product_service.update_product.js index 359a30ef..7c7a9f41 100644 --- a/samples/generated/v2/product_service.update_product.js +++ b/samples/generated/v2/product_service.update_product.js @@ -43,6 +43,10 @@ function main(product) { * fields that are neither immutable nor output only) are updated. * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. + * The attribute key can be updated by setting the mask path as + * "attributes.${key_name}". If a key name is present in the mask but not in + * the patching product from the request, this key will be deleted after the + * update. */ // const updateMask = {} /** diff --git a/samples/generated/v2/search_service.search.js b/samples/generated/v2/search_service.search.js index 2083811f..26118e14 100644 --- a/samples/generated/v2/search_service.search.js +++ b/samples/generated/v2/search_service.search.js @@ -27,7 +27,7 @@ function main(placement, visitorId) { */ /** * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. */ @@ -41,6 +41,10 @@ function main(placement, visitorId) { // const branch = 'abc123' /** * Raw search query. + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * filter google.cloud.retail.v2.SearchRequest.filter and + * page_categories google.cloud.retail.v2.SearchRequest.page_categories. */ // const query = 'abc123' /** @@ -126,10 +130,10 @@ function main(placement, visitorId) { * Boost specification to boost certain products. See more details at this * user guide (https://cloud.google.com/retail/docs/boosting). * Notice that if both ServingConfig.boost_control_ids and - * SearchRequest.boost_spec are set, the boost conditions from both places - * are evaluated. If a search request matches multiple boost conditions, - * the final boost score is equal to the sum of the boost scores from all - * matched boost conditions. + * SearchRequest.boost_spec google.cloud.retail.v2.SearchRequest.boost_spec + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. */ // const boostSpec = {} /** @@ -163,7 +167,8 @@ function main(placement, visitorId) { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * Product.inventories.attributes map. + * Product.local_inventories.attributes google.cloud.retail.v2.LocalInventory.attributes + * map. * * attributes.key, where key is any key in the * Product.attributes google.cloud.retail.v2.Product.attributes map. * * pickupInStore.id, where id is any @@ -228,6 +233,29 @@ function main(placement, visitorId) { * The specification for personalization. */ // const personalizationSpec = {} + /** + * The labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See Google Cloud + * Document (https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + */ + // const labels = 1234 + /** + * The spell correction specification that specifies the mode under + * which spell correction will take effect. + */ + // const spellCorrectionSpec = {} // Imports the Retail library const {SearchServiceClient} = require('@google-cloud/retail').v2; diff --git a/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json b/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json index 7949361c..2d159003 100644 --- a/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json +++ b/samples/generated/v2/snippet_metadata.google.cloud.retail.v2.json @@ -318,7 +318,7 @@ "segments": [ { "start": 25, - "end": 153, + "end": 162, "type": "FULL" } ], @@ -530,7 +530,7 @@ "segments": [ { "start": 25, - "end": 72, + "end": 76, "type": "FULL" } ], @@ -611,14 +611,14 @@ "regionTag": "retail_v2_generated_ProductService_ImportProducts_async", "title": "CatalogService importProducts Sample", "origin": "API_DEFINITION", - "description": " Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. Request processing may be synchronous. No partial updating is supported. Non-existing items are created. Note that it is possible for a subset of the [Product][google.cloud.retail.v2.Product]s to be successfully updated.", + "description": " Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. Request processing may be synchronous. Non-existing items are created. Note that it is possible for a subset of the [Product][google.cloud.retail.v2.Product]s to be successfully updated.", "canonical": true, "file": "product_service.import_products.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 85, + "end": 91, "type": "FULL" } ], @@ -675,7 +675,7 @@ "regionTag": "retail_v2_generated_ProductService_SetInventory_async", "title": "CatalogService setInventory Sample", "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2.ProductService.SetInventory], [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", + "description": " Updates inventory information for a [Product][google.cloud.retail.v2.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2.Product] queried by [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or [ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. When inventory is updated with [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] or [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], then any pre-existing inventory information for this product will be used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], then any existing inventory information will be preserved. Pre-existing inventory information can only be updated with [SetInventory][google.cloud.retail.v2.ProductService.SetInventory], [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], and [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. This feature is only available for users who have Retail Search enabled. Please enable Retail Search on Cloud Console before using this feature.", "canonical": true, "file": "product_service.set_inventory.js", "language": "JAVASCRIPT", @@ -790,7 +790,7 @@ "segments": [ { "start": 25, - "end": 103, + "end": 104, "type": "FULL" } ], @@ -954,7 +954,7 @@ "segments": [ { "start": 25, - "end": 252, + "end": 280, "type": "FULL" } ], @@ -1038,6 +1038,14 @@ { "name": "personalization_spec", "type": ".google.cloud.retail.v2.SearchRequest.PersonalizationSpec" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "spell_correction_spec", + "type": ".google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec" } ], "resultType": ".google.cloud.retail.v2.SearchResponse", diff --git a/src/v2/completion_service_client.ts b/src/v2/completion_service_client.ts index ceec448c..2cdbab92 100644 --- a/src/v2/completion_service_client.ts +++ b/src/v2/completion_service_client.ts @@ -392,9 +392,9 @@ export class CompletionServiceClient { * * * user-data * - * * cloud-retail - * This option requires additional allowlisting. Before using cloud-retail, - * contact Cloud Retail support team first. + * * cloud-retail: + * This option requires enabling auto-learning function first. See + * [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). * @param {number} request.maxSuggestions * Completion max suggestions. If left unset or set to 0, then will fallback * to the configured value {@link |CompletionConfig.max_suggestions}. diff --git a/src/v2/prediction_service_client.ts b/src/v2/prediction_service_client.ts index 436b568e..1aa966c6 100644 --- a/src/v2/prediction_service_client.ts +++ b/src/v2/prediction_service_client.ts @@ -314,6 +314,16 @@ export class PredictionServiceClient { * they took to trigger the predict request. Note that this user event detail * won't be ingested to userEvent logs. Thus, a separate userEvent write * request is required for event logging. + * + * Don't set + * {@link google.cloud.retail.v2.UserEvent.visitor_id|UserEvent.visitor_id} or + * {@link google.cloud.retail.v2.UserInfo.user_id|UserInfo.user_id} to the same + * fixed ID for different users. If you are trying to receive non-personalized + * recommendations (not recommended; this can negatively impact model + * performance), instead set + * {@link google.cloud.retail.v2.UserEvent.visitor_id|UserEvent.visitor_id} to a + * random unique ID and leave + * {@link google.cloud.retail.v2.UserInfo.user_id|UserInfo.user_id} unset. * @param {number} request.pageSize * Maximum number of results to return per page. Set this property * to the number of prediction results needed. If zero, the service will @@ -388,7 +398,7 @@ export class PredictionServiceClient { * * Each resource can have multiple labels, up to a maximum of 64. * * Each label must be a key-value pair. * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters, and cannot be empty. Values can be empty, and have a maximum + * characters and cannot be empty. Values can be empty and have a maximum * length of 63 characters. * * Keys and values can contain only lowercase letters, numeric characters, * underscores, and dashes. All characters must use UTF-8 encoding, and diff --git a/src/v2/product_service_client.ts b/src/v2/product_service_client.ts index 5c4d892a..7e91e71a 100644 --- a/src/v2/product_service_client.ts +++ b/src/v2/product_service_client.ts @@ -645,6 +645,11 @@ export class ProductServiceClient { * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. + * + * The attribute key can be updated by setting the mask path as + * "attributes.${key_name}". If a key name is present in the mask but not in + * the patching product from the request, this key will be deleted after the + * update. * @param {boolean} request.allowMissing * If set to true, and the {@link google.cloud.retail.v2.Product|Product} is not * found, a new {@link google.cloud.retail.v2.Product|Product} will be created. In @@ -836,7 +841,7 @@ export class ProductServiceClient { /** * Bulk import of multiple {@link google.cloud.retail.v2.Product|Product}s. * - * Request processing may be synchronous. No partial updating is supported. + * Request processing may be synchronous. * Non-existing items are created. * * Note that it is possible for a subset of the @@ -864,11 +869,18 @@ export class ProductServiceClient { * imported. Defaults to * {@link google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL|ReconciliationMode.INCREMENTAL}. * @param {string} request.notificationPubsubTopic - * Pub/Sub topic for receiving notification. If this field is set, + * Full Pub/Sub topic name for receiving notification. If this field is set, * when the import is finished, a notification will be sent to * specified Pub/Sub topic. The message data will be JSON string of a * {@link google.longrunning.Operation|Operation}. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + * + * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + * to be within the same project as + * {@link google.cloud.retail.v2.ImportProductsRequest.parent|ImportProductsRequest.parent}. + * Make sure that both + * `cloud-retail-customer-data-access@system.gserviceaccount.com` and + * `service-@gcp-sa-retail.iam.gserviceaccount.com` + * have the `pubsub.topics.publish` IAM permission on the topic. * * Only supported when * {@link google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} @@ -1038,7 +1050,7 @@ export class ProductServiceClient { * * Pre-existing inventory information can only be updated with * {@link google.cloud.retail.v2.ProductService.SetInventory|SetInventory}, - * {@link google.cloud.retail.v2.ProductService.AddFulfillmentPlaces|AddFulfillmentPlaces}, + * {@link google.cloud.retail.v2.ProductService.AddFulfillmentPlaces|ProductService.AddFulfillmentPlaces}, * and * {@link google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces|RemoveFulfillmentPlaces}. * @@ -1498,7 +1510,8 @@ export class ProductServiceClient { * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. * - * This field directly corresponds to {@link |Product.fulfillment_info.type}. + * This field directly corresponds to + * {@link google.cloud.retail.v2.FulfillmentInfo.type|Product.fulfillment_info.type}. * @param {string[]} request.placeIds * Required. The IDs for this * {@link google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type|type}, such as diff --git a/src/v2/search_service_client.ts b/src/v2/search_service_client.ts index cf269f44..15c6c05e 100644 --- a/src/v2/search_service_client.ts +++ b/src/v2/search_service_client.ts @@ -331,7 +331,7 @@ export class SearchServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -342,6 +342,11 @@ export class SearchServiceClient { * products under the default branch. * @param {string} request.query * Raw search query. + * + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * {@link google.cloud.retail.v2.SearchRequest.filter|filter} and + * {@link google.cloud.retail.v2.SearchRequest.page_categories|page_categories}. * @param {string} request.visitorId * Required. A unique identifier for tracking visitors. For example, this * could be implemented with an HTTP cookie, which should be able to uniquely @@ -424,10 +429,10 @@ export class SearchServiceClient { * [user guide](https://cloud.google.com/retail/docs/boosting). * * Notice that if both {@link |ServingConfig.boost_control_ids} and - * [SearchRequest.boost_spec] are set, the boost conditions from both places - * are evaluated. If a search request matches multiple boost conditions, - * the final boost score is equal to the sum of the boost scores from all - * matched boost conditions. + * {@link google.cloud.retail.v2.SearchRequest.boost_spec|SearchRequest.boost_spec} + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -460,7 +465,8 @@ export class SearchServiceClient { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * {@link |Product.inventories.attributes} map. + * {@link google.cloud.retail.v2.LocalInventory.attributes|Product.local_inventories.attributes} + * map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -520,6 +526,27 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * @param {number[]} request.labels + * The labels applied to a resource must meet the following requirements: + * + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * @param {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec + * The spell correction specification that specifies the mode under + * which spell correction will take effect. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -606,7 +633,7 @@ export class SearchServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -617,6 +644,11 @@ export class SearchServiceClient { * products under the default branch. * @param {string} request.query * Raw search query. + * + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * {@link google.cloud.retail.v2.SearchRequest.filter|filter} and + * {@link google.cloud.retail.v2.SearchRequest.page_categories|page_categories}. * @param {string} request.visitorId * Required. A unique identifier for tracking visitors. For example, this * could be implemented with an HTTP cookie, which should be able to uniquely @@ -699,10 +731,10 @@ export class SearchServiceClient { * [user guide](https://cloud.google.com/retail/docs/boosting). * * Notice that if both {@link |ServingConfig.boost_control_ids} and - * [SearchRequest.boost_spec] are set, the boost conditions from both places - * are evaluated. If a search request matches multiple boost conditions, - * the final boost score is equal to the sum of the boost scores from all - * matched boost conditions. + * {@link google.cloud.retail.v2.SearchRequest.boost_spec|SearchRequest.boost_spec} + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -735,7 +767,8 @@ export class SearchServiceClient { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * {@link |Product.inventories.attributes} map. + * {@link google.cloud.retail.v2.LocalInventory.attributes|Product.local_inventories.attributes} + * map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -795,6 +828,27 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * @param {number[]} request.labels + * The labels applied to a resource must meet the following requirements: + * + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * @param {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec + * The spell correction specification that specifies the mode under + * which spell correction will take effect. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -837,7 +891,7 @@ export class SearchServiceClient { * The request object that will be sent. * @param {string} request.placement * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` + * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. * This field is used to identify the serving configuration name and the set * of models that will be used to make the search. * @param {string} request.branch @@ -848,6 +902,11 @@ export class SearchServiceClient { * products under the default branch. * @param {string} request.query * Raw search query. + * + * If this field is empty, the request is considered a category browsing + * request and returned results are based on + * {@link google.cloud.retail.v2.SearchRequest.filter|filter} and + * {@link google.cloud.retail.v2.SearchRequest.page_categories|page_categories}. * @param {string} request.visitorId * Required. A unique identifier for tracking visitors. For example, this * could be implemented with an HTTP cookie, which should be able to uniquely @@ -930,10 +989,10 @@ export class SearchServiceClient { * [user guide](https://cloud.google.com/retail/docs/boosting). * * Notice that if both {@link |ServingConfig.boost_control_ids} and - * [SearchRequest.boost_spec] are set, the boost conditions from both places - * are evaluated. If a search request matches multiple boost conditions, - * the final boost score is equal to the sum of the boost scores from all - * matched boost conditions. + * {@link google.cloud.retail.v2.SearchRequest.boost_spec|SearchRequest.boost_spec} + * are set, the boost conditions from both places are evaluated. If a search + * request matches multiple boost conditions, the final boost score is equal + * to the sum of the boost scores from all matched boost conditions. * @param {google.cloud.retail.v2.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec * The query expansion specification that specifies the conditions under which * query expansion will occur. See more details at this [user @@ -966,7 +1025,8 @@ export class SearchServiceClient { * * inventory(place_id,price) * * inventory(place_id,original_price) * * inventory(place_id,attributes.key), where key is any key in the - * {@link |Product.inventories.attributes} map. + * {@link google.cloud.retail.v2.LocalInventory.attributes|Product.local_inventories.attributes} + * map. * * attributes.key, where key is any key in the * {@link google.cloud.retail.v2.Product.attributes|Product.attributes} map. * * pickupInStore.id, where id is any @@ -1026,6 +1086,27 @@ export class SearchServiceClient { * request triggers both product search and faceted search. * @param {google.cloud.retail.v2.SearchRequest.PersonalizationSpec} request.personalizationSpec * The specification for personalization. + * @param {number[]} request.labels + * The labels applied to a resource must meet the following requirements: + * + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * @param {google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec + * The spell correction specification that specifies the mode under + * which spell correction will take effect. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object}