search_service.proto 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.retail.v2beta;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/cloud/retail/v2beta/common.proto";
  21. import "google/cloud/retail/v2beta/product.proto";
  22. import "google/protobuf/field_mask.proto";
  23. import "google/protobuf/struct.proto";
  24. import "google/protobuf/timestamp.proto";
  25. import "google/protobuf/wrappers.proto";
  26. option csharp_namespace = "Google.Cloud.Retail.V2Beta";
  27. option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail";
  28. option java_multiple_files = true;
  29. option java_outer_classname = "SearchServiceProto";
  30. option java_package = "com.google.cloud.retail.v2beta";
  31. option objc_class_prefix = "RETAIL";
  32. option php_namespace = "Google\\Cloud\\Retail\\V2beta";
  33. option ruby_package = "Google::Cloud::Retail::V2beta";
  34. // Service for search.
  35. //
  36. // This feature is only available for users who have Retail Search enabled.
  37. // Contact Retail Support (retail-search-support@google.com) if you are
  38. // interested in using Retail Search.
  39. service SearchService {
  40. option (google.api.default_host) = "retail.googleapis.com";
  41. option (google.api.oauth_scopes) =
  42. "https://www.googleapis.com/auth/cloud-platform";
  43. // Performs a search.
  44. //
  45. // This feature is only available for users who have Retail Search enabled.
  46. // Contact Retail Support (retail-search-support@google.com) if you are
  47. // interested in using Retail Search.
  48. rpc Search(SearchRequest) returns (SearchResponse) {
  49. option (google.api.http) = {
  50. post: "/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:search"
  51. body: "*"
  52. };
  53. }
  54. }
  55. // Request message for
  56. // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]
  57. // method.
  58. message SearchRequest {
  59. // A facet specification to perform faceted search.
  60. message FacetSpec {
  61. // Specifies how a facet is computed.
  62. message FacetKey {
  63. // Required. Supported textual and numerical facet keys in
  64. // [Product][google.cloud.retail.v2beta.Product] object, over which the
  65. // facet values are computed. Facet key is case-sensitive.
  66. //
  67. // Allowed facet keys when
  68. // [FacetKey.query][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.query]
  69. // is not specified:
  70. //
  71. // Textual facet keys:
  72. // * brands
  73. // * categories
  74. // * genders
  75. // * ageGroups
  76. // * availability
  77. // * colorFamilies
  78. // * colors
  79. // * sizes
  80. // * materials
  81. // * patterns
  82. // * conditions
  83. // * attributes.key
  84. // * pickupInStore
  85. // * shipToStore
  86. // * sameDayDelivery
  87. // * nextDayDelivery
  88. // * customFulfillment1
  89. // * customFulfillment2
  90. // * customFulfillment3
  91. // * customFulfillment4
  92. // * customFulfillment5
  93. //
  94. // Numeric facet keys:
  95. // * price
  96. // * discount
  97. // * rating
  98. // * ratingCount
  99. // * attributes.key
  100. string key = 1 [(google.api.field_behavior) = REQUIRED];
  101. // Set only if values should be bucketized into intervals. Must be set
  102. // for facets with numerical values. Must not be set for facet with text
  103. // values. Maximum number of intervals is 30.
  104. repeated Interval intervals = 2;
  105. // Only get facet for the given restricted values. For example, when using
  106. // "pickupInStore" as key and set restricted values to
  107. // ["store123", "store456"], only facets for "store123" and "store456" are
  108. // returned. Only supported on textual fields and fulfillments.
  109. // Maximum is 20.
  110. //
  111. // Must be set for the fulfillment facet keys:
  112. //
  113. // * pickupInStore
  114. //
  115. // * shipToStore
  116. //
  117. // * sameDayDelivery
  118. //
  119. // * nextDayDelivery
  120. //
  121. // * customFulfillment1
  122. //
  123. // * customFulfillment2
  124. //
  125. // * customFulfillment3
  126. //
  127. // * customFulfillment4
  128. //
  129. // * customFulfillment5
  130. repeated string restricted_values = 3;
  131. // Only get facet values that start with the given string prefix. For
  132. // example, suppose "categories" has three values "Women > Shoe",
  133. // "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the
  134. // "categories" facet will give only "Women > Shoe" and "Women > Dress".
  135. // Only supported on textual fields. Maximum is 10.
  136. repeated string prefixes = 8;
  137. // Only get facet values that contains the given strings. For example,
  138. // suppose "categories" has three values "Women > Shoe",
  139. // "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the
  140. // "categories" facet will give only "Women > Shoe" and "Men > Shoe".
  141. // Only supported on textual fields. Maximum is 10.
  142. repeated string contains = 9;
  143. // The order in which [Facet.values][] are returned.
  144. //
  145. // Allowed values are:
  146. //
  147. // * "count desc", which means order by [Facet.FacetValue.count][]
  148. // descending.
  149. //
  150. // * "value desc", which means order by [Facet.FacetValue.value][]
  151. // descending.
  152. // Only applies to textual facets.
  153. //
  154. // If not set, textual values are sorted in [natural
  155. // order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
  156. // intervals are sorted in the order given by
  157. // [FacetSpec.FacetKey.intervals][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.intervals];
  158. // [FulfillmentInfo.ids][] are sorted in the order given by
  159. // [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.restricted_values].
  160. string order_by = 4;
  161. // The query that is used to compute facet for the given facet key.
  162. // When provided, it will override the default behavior of facet
  163. // computation. The query syntax is the same as a filter expression. See
  164. // [SearchRequest.filter][google.cloud.retail.v2beta.SearchRequest.filter]
  165. // for detail syntax and limitations. Notice that there is no limitation
  166. // on
  167. // [FacetKey.key][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.key]
  168. // when query is specified.
  169. //
  170. // In the response, [FacetValue.value][] will be always "1" and
  171. // [FacetValue.count][] will be the number of results that matches the
  172. // query.
  173. //
  174. // For example, you can set a customized facet for "shipToStore",
  175. // where
  176. // [FacetKey.key][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.key]
  177. // is "customizedShipToStore", and
  178. // [FacetKey.query][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.query]
  179. // is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")".
  180. // Then the facet will count the products that are both in stock and ship
  181. // to store "123".
  182. string query = 5;
  183. }
  184. // Required. The facet key specification.
  185. FacetKey facet_key = 1 [(google.api.field_behavior) = REQUIRED];
  186. // Maximum of facet values that should be returned for this facet. If
  187. // unspecified, defaults to 20. The maximum allowed value is 300. Values
  188. // above 300 will be coerced to 300.
  189. //
  190. // If this field is negative, an INVALID_ARGUMENT is returned.
  191. int32 limit = 2;
  192. // List of keys to exclude when faceting.
  193. //
  194. // By default,
  195. // [FacetKey.key][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.key]
  196. // is not excluded from the filter unless it is listed in this field.
  197. //
  198. // For example, suppose there are 100 products with color facet "Red" and
  199. // 200 products with color facet "Blue". A query containing the filter
  200. // "colorFamilies:ANY("Red")" and have "colorFamilies" as
  201. // [FacetKey.key][google.cloud.retail.v2beta.SearchRequest.FacetSpec.FacetKey.key]
  202. // will by default return the "Red" with count 100.
  203. //
  204. // If this field contains "colorFamilies", then the query returns both the
  205. // "Red" with count 100 and "Blue" with count 200, because the
  206. // "colorFamilies" key is now excluded from the filter.
  207. //
  208. // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
  209. // is returned.
  210. repeated string excluded_filter_keys = 3;
  211. // Enables dynamic position for this facet. If set to true, the position of
  212. // this facet among all facets in the response is determined by Google
  213. // Retail Search. It will be ordered together with dynamic facets if dynamic
  214. // facets is enabled. If set to false, the position of this facet in the
  215. // response will be the same as in the request, and it will be ranked before
  216. // the facets with dynamic position enable and all dynamic facets.
  217. //
  218. // For example, you may always want to have rating facet returned in
  219. // the response, but it's not necessarily to always display the rating facet
  220. // at the top. In that case, you can set enable_dynamic_position to true so
  221. // that the position of rating facet in response will be determined by
  222. // Google Retail Search.
  223. //
  224. // Another example, assuming you have the following facets in the request:
  225. //
  226. // * "rating", enable_dynamic_position = true
  227. //
  228. // * "price", enable_dynamic_position = false
  229. //
  230. // * "brands", enable_dynamic_position = false
  231. //
  232. // And also you have a dynamic facets enable, which will generate a facet
  233. // 'gender'. Then the final order of the facets in the response can be
  234. // ("price", "brands", "rating", "gender") or ("price", "brands", "gender",
  235. // "rating") depends on how Google Retail Search orders "gender" and
  236. // "rating" facets. However, notice that "price" and "brands" will always be
  237. // ranked at 1st and 2nd position since their enable_dynamic_position are
  238. // false.
  239. bool enable_dynamic_position = 4;
  240. }
  241. // The specifications of dynamically generated facets.
  242. message DynamicFacetSpec {
  243. // Enum to control DynamicFacet mode
  244. enum Mode {
  245. // Default value.
  246. MODE_UNSPECIFIED = 0;
  247. // Disable Dynamic Facet.
  248. DISABLED = 1;
  249. // Automatic mode built by Google Retail Search.
  250. ENABLED = 2;
  251. }
  252. // Mode of the DynamicFacet feature.
  253. // Defaults to
  254. // [Mode.DISABLED][google.cloud.retail.v2beta.SearchRequest.DynamicFacetSpec.Mode.DISABLED]
  255. // if it's unset.
  256. Mode mode = 1;
  257. }
  258. // Boost specification to boost certain items.
  259. message BoostSpec {
  260. // Boost applies to products which match a condition.
  261. message ConditionBoostSpec {
  262. // An expression which specifies a boost condition. The syntax and
  263. // supported fields are the same as a filter expression. See
  264. // [SearchRequest.filter][google.cloud.retail.v2beta.SearchRequest.filter]
  265. // for detail syntax and limitations.
  266. //
  267. // Examples:
  268. //
  269. // * To boost products with product ID "product_1" or "product_2", and
  270. // color "Red" or "Blue":
  271. // ```
  272. // (id: ANY("product_1", "product_2"))
  273. // AND
  274. // (colorFamilies: ANY("Red", "Blue"))
  275. // ```
  276. string condition = 1;
  277. // Strength of the condition boost, which should be in [-1, 1]. Negative
  278. // boost means demotion. Default is 0.0.
  279. //
  280. // Setting to 1.0 gives the item a big promotion. However, it does not
  281. // necessarily mean that the boosted item will be the top result at all
  282. // times, nor that other items will be excluded. Results could still be
  283. // shown even when none of them matches the condition. And results that
  284. // are significantly more relevant to the search query can still trump
  285. // your heavily favored but irrelevant items.
  286. //
  287. // Setting to -1.0 gives the item a big demotion. However, results that
  288. // are deeply relevant might still be shown. The item will have an
  289. // upstream battle to get a fairly high ranking, but it is not blocked out
  290. // completely.
  291. //
  292. // Setting to 0.0 means no boost applied. The boosting condition is
  293. // ignored.
  294. float boost = 2;
  295. }
  296. // Condition boost specifications. If a product matches multiple conditions
  297. // in the specifictions, boost scores from these specifications are all
  298. // applied and combined in a non-linear way. Maximum number of
  299. // specifications is 10.
  300. repeated ConditionBoostSpec condition_boost_specs = 1;
  301. }
  302. // Specification to determine under which conditions query expansion should
  303. // occur.
  304. message QueryExpansionSpec {
  305. // Enum describing under which condition query expansion should occur.
  306. enum Condition {
  307. // Unspecified query expansion condition. This defaults to
  308. // [Condition.DISABLED][google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
  309. CONDITION_UNSPECIFIED = 0;
  310. // Disabled query expansion. Only the exact search query is used, even if
  311. // [SearchResponse.total_size][google.cloud.retail.v2beta.SearchResponse.total_size]
  312. // is zero.
  313. DISABLED = 1;
  314. // Automatic query expansion built by Google Retail Search.
  315. AUTO = 3;
  316. }
  317. // The condition under which query expansion should occur. Default to
  318. // [Condition.DISABLED][google.cloud.retail.v2beta.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
  319. Condition condition = 1;
  320. }
  321. // Required. The resource name of the search engine placement, such as
  322. // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`.
  323. // This field is used to identify the set of models that will be used to make
  324. // the search.
  325. //
  326. // We currently support one placement with the following ID:
  327. //
  328. // * `default_search`.
  329. string placement = 1 [(google.api.field_behavior) = REQUIRED];
  330. // The branch resource name, such as
  331. // `projects/*/locations/global/catalogs/default_catalog/branches/0`.
  332. //
  333. // Use "default_branch" as the branch ID or leave this field empty, to search
  334. // products under the default branch.
  335. string branch = 2 [
  336. (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" }
  337. ];
  338. // Raw search query.
  339. string query = 3;
  340. // Required. A unique identifier for tracking visitors. For example, this
  341. // could be implemented with an HTTP cookie, which should be able to uniquely
  342. // identify a visitor on a single device. This unique identifier should not
  343. // change if the visitor logs in or out of the website.
  344. //
  345. // The field must be a UTF-8 encoded string with a length limit of 128
  346. // characters. Otherwise, an INVALID_ARGUMENT error is returned.
  347. string visitor_id = 4 [(google.api.field_behavior) = REQUIRED];
  348. // User information.
  349. UserInfo user_info = 5;
  350. // Maximum number of [Product][google.cloud.retail.v2beta.Product]s to return.
  351. // If unspecified, defaults to a reasonable value. The maximum allowed value
  352. // is 120. Values above 120 will be coerced to 120.
  353. //
  354. // If this field is negative, an INVALID_ARGUMENT is returned.
  355. int32 page_size = 7;
  356. // A page token
  357. // [SearchResponse.next_page_token][google.cloud.retail.v2beta.SearchResponse.next_page_token],
  358. // received from a previous
  359. // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]
  360. // call. Provide this to retrieve the subsequent page.
  361. //
  362. // When paginating, all other parameters provided to
  363. // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]
  364. // must match the call that provided the page token. Otherwise, an
  365. // INVALID_ARGUMENT error is returned.
  366. string page_token = 8;
  367. // A 0-indexed integer that specifies the current offset (that is, starting
  368. // result location, amongst the [Product][google.cloud.retail.v2beta.Product]s
  369. // deemed by the API as relevant) in search results. This field is only
  370. // considered if
  371. // [page_token][google.cloud.retail.v2beta.SearchRequest.page_token] is unset.
  372. //
  373. // If this field is negative, an INVALID_ARGUMENT is returned.
  374. int32 offset = 9;
  375. // The filter syntax consists of an expression language for constructing a
  376. // predicate from one or more fields of the products being filtered. Filter
  377. // expression is case-sensitive.
  378. //
  379. // If this field is unrecognizable, an INVALID_ARGUMENT is returned.
  380. string filter = 10;
  381. // The filter applied to every search request when quality improvement such as
  382. // query expansion is needed. For example, if a query does not have enough
  383. // results, an expanded query with
  384. // [SearchRequest.canonical_filter][google.cloud.retail.v2beta.SearchRequest.canonical_filter]
  385. // will be returned as a supplement of the original query. This field is
  386. // strongly recommended to achieve high search quality.
  387. //
  388. // See [SearchRequest.filter][google.cloud.retail.v2beta.SearchRequest.filter]
  389. // for more details about filter syntax.
  390. string canonical_filter = 28;
  391. // The order in which products are returned. Products can be ordered by
  392. // a field in an [Product][google.cloud.retail.v2beta.Product] object. Leave
  393. // it unset if ordered by relevance. OrderBy expression is case-sensitive.
  394. //
  395. // If this field is unrecognizable, an INVALID_ARGUMENT is returned.
  396. string order_by = 11;
  397. // Facet specifications for faceted search. If empty, no facets are returned.
  398. //
  399. // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
  400. // is returned.
  401. repeated FacetSpec facet_specs = 12;
  402. // The specification for dynamically generated facets. Notice that only
  403. // textual facets can be dynamically generated.
  404. //
  405. // This feature requires additional allowlisting. Contact Retail Support
  406. // (retail-search-support@google.com) if you are interested in using dynamic
  407. // facet feature.
  408. DynamicFacetSpec dynamic_facet_spec = 21;
  409. // Boost specification to boost certain products.
  410. BoostSpec boost_spec = 13;
  411. // The query expansion specification that specifies the conditions under which
  412. // query expansion will occur.
  413. QueryExpansionSpec query_expansion_spec = 14;
  414. // The keys to fetch and rollup the matching
  415. // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT]
  416. // [Product][google.cloud.retail.v2beta.Product]s attributes. The attributes
  417. // from all the matching
  418. // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT]
  419. // [Product][google.cloud.retail.v2beta.Product]s are merged and
  420. // de-duplicated. Notice that rollup
  421. // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT]
  422. // [Product][google.cloud.retail.v2beta.Product]s attributes will lead to
  423. // extra query latency. Maximum number of keys is 10.
  424. //
  425. // For
  426. // [Product.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info],
  427. // a fulfillment type and a fulfillment ID must be provided in the format of
  428. // "fulfillmentType.filfillmentId". E.g., in "pickupInStore.store123",
  429. // "pickupInStore" is fulfillment type and "store123" is the store ID.
  430. //
  431. // Supported keys are:
  432. //
  433. // * colorFamilies
  434. // * price
  435. // * originalPrice
  436. // * discount
  437. // * attributes.key, where key is any key in the
  438. // [Product.attributes][google.cloud.retail.v2beta.Product.attributes] map.
  439. // * pickupInStore.id, where id is any [FulfillmentInfo.ids][] for type
  440. // [FulfillmentInfo.Type.PICKUP_IN_STORE][].
  441. // * shipToStore.id, where id is any [FulfillmentInfo.ids][] for type
  442. // [FulfillmentInfo.Type.SHIP_TO_STORE][].
  443. // * sameDayDelivery.id, where id is any [FulfillmentInfo.ids][] for type
  444. // [FulfillmentInfo.Type.SAME_DAY_DELIVERY][].
  445. // * nextDayDelivery.id, where id is any [FulfillmentInfo.ids][] for type
  446. // [FulfillmentInfo.Type.NEXT_DAY_DELIVERY][].
  447. // * customFulfillment1.id, where id is any [FulfillmentInfo.ids][] for type
  448. // [FulfillmentInfo.Type.CUSTOM_TYPE_1][].
  449. // * customFulfillment2.id, where id is any [FulfillmentInfo.ids][] for type
  450. // [FulfillmentInfo.Type.CUSTOM_TYPE_2][].
  451. // * customFulfillment3.id, where id is any [FulfillmentInfo.ids][] for type
  452. // [FulfillmentInfo.Type.CUSTOM_TYPE_3][].
  453. // * customFulfillment4.id, where id is any [FulfillmentInfo.ids][] for type
  454. // [FulfillmentInfo.Type.CUSTOM_TYPE_4][].
  455. // * customFulfillment5.id, where id is any [FulfillmentInfo.ids][] for type
  456. // [FulfillmentInfo.Type.CUSTOM_TYPE_5][].
  457. //
  458. // If this field is set to an invalid value other than these, an
  459. // INVALID_ARGUMENT error is returned.
  460. repeated string variant_rollup_keys = 17;
  461. // The categories associated with a category page. Required for category
  462. // navigation queries to achieve good search quality. The format should be
  463. // the same as
  464. // [UserEvent.page_categories][google.cloud.retail.v2beta.UserEvent.page_categories];
  465. //
  466. // To represent full path of category, use '>' sign to separate different
  467. // hierarchies. If '>' is part of the category name, please replace it with
  468. // other character(s).
  469. //
  470. // Category pages include special pages such as sales or promotions. For
  471. // instance, a special sale page may have the category hierarchy:
  472. // "pageCategories" : ["Sales > 2017 Black Friday Deals"].
  473. repeated string page_categories = 23;
  474. }
  475. // Response message for
  476. // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search]
  477. // method.
  478. message SearchResponse {
  479. // Represents the search results.
  480. message SearchResult {
  481. // [Product.id][google.cloud.retail.v2beta.Product.id] of the searched
  482. // [Product][google.cloud.retail.v2beta.Product].
  483. string id = 1;
  484. // The product data snippet in the search response. Only
  485. // [Product.name][google.cloud.retail.v2beta.Product.name] is guaranteed to
  486. // be populated.
  487. //
  488. // [Product.variants][google.cloud.retail.v2beta.Product.variants] contains
  489. // the product variants that match the search query. If there are multiple
  490. // product variants matching the query, top 5 most relevant product variants
  491. // are returned and ordered by relevancy.
  492. //
  493. // If relevancy can be deternmined, use
  494. // [matching_variant_fields][google.cloud.retail.v2beta.SearchResponse.SearchResult.matching_variant_fields]
  495. // to look up matched product variants fields. If relevancy cannot be
  496. // determined, e.g. when searching "shoe" all products in a shoe product can
  497. // be a match, 5 product variants are returned but order is meaningless.
  498. Product product = 2;
  499. // The count of matched
  500. // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT]
  501. // [Product][google.cloud.retail.v2beta.Product]s.
  502. int32 matching_variant_count = 3;
  503. // If a [variant][google.cloud.retail.v2beta.Product.Type.VARIANT]
  504. // [Product][google.cloud.retail.v2beta.Product] matches the search query,
  505. // this map indicates which [Product][google.cloud.retail.v2beta.Product]
  506. // fields are matched. The key is the
  507. // [Product.name][google.cloud.retail.v2beta.Product.name], the value is a
  508. // field mask of the matched [Product][google.cloud.retail.v2beta.Product]
  509. // fields. If matched attributes cannot be determined, this map will be
  510. // empty.
  511. //
  512. // For example, a key "sku1" with field mask
  513. // "products.color_info" indicates there is a match between
  514. // "sku1" [ColorInfo][google.cloud.retail.v2beta.ColorInfo] and the query.
  515. map<string, google.protobuf.FieldMask> matching_variant_fields = 4;
  516. // The rollup matching
  517. // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT]
  518. // [Product][google.cloud.retail.v2beta.Product] attributes. The key is one
  519. // of the
  520. // [SearchRequest.variant_rollup_keys][google.cloud.retail.v2beta.SearchRequest.variant_rollup_keys].
  521. // The values are the merged and de-duplicated
  522. // [Product][google.cloud.retail.v2beta.Product] attributes. Notice that the
  523. // rollup values are respect filter. For example, when filtering by
  524. // "colorFamilies:ANY(\"red\")" and rollup "colorFamilies", only "red" is
  525. // returned.
  526. //
  527. // For textual and numerical attributes, the rollup values is a list of
  528. // string or double values with type
  529. // [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if
  530. // there are two variants with colors "red" and "blue", the rollup values
  531. // are { key: "colorFamilies"
  532. // value {
  533. // list_value {
  534. // values { string_value: "red" }
  535. // values { string_value: "blue" }
  536. // }
  537. // }
  538. // }
  539. //
  540. // For
  541. // [Product.fulfillment_info][google.cloud.retail.v2beta.Product.fulfillment_info],
  542. // the rollup values is a double value with type
  543. // [google.protobuf.Value][google.protobuf.Value]. For example, {key:
  544. // "pickupInStore.store1" value { number_value: 10 }} means a there are 10
  545. // variants in this product are available in the store "store1".
  546. map<string, google.protobuf.Value> variant_rollup_values = 5;
  547. }
  548. // A facet result.
  549. message Facet {
  550. // A facet value which contains value names and their count.
  551. message FacetValue {
  552. // A facet value which contains values.
  553. oneof facet_value {
  554. // Text value of a facet, such as "Black" for facet "colorFamilies".
  555. string value = 1;
  556. // Interval value for a facet, such as [10, 20) for facet "price".
  557. Interval interval = 2;
  558. }
  559. // Number of items that have this facet value.
  560. int64 count = 3;
  561. }
  562. // The key for this facet. E.g., "colorFamilies" or "price" or
  563. // "attributes.attr1".
  564. string key = 1;
  565. // The facet values for this field.
  566. repeated FacetValue values = 2;
  567. // Whether the facet is dynamically generated.
  568. bool dynamic_facet = 3;
  569. }
  570. // Information describing query expansion including whether expansion has
  571. // occurred.
  572. message QueryExpansionInfo {
  573. // Bool describing whether query expansion has occurred.
  574. bool expanded_query = 1;
  575. }
  576. // A list of matched items. The order represents the ranking.
  577. repeated SearchResult results = 1;
  578. // Results of facets requested by user.
  579. repeated Facet facets = 2;
  580. // The estimated total count of matched items irrespective of pagination. The
  581. // count of [results][google.cloud.retail.v2beta.SearchResponse.results]
  582. // returned by pagination may be less than the
  583. // [total_size][google.cloud.retail.v2beta.SearchResponse.total_size] that
  584. // matches.
  585. int32 total_size = 3;
  586. // If spell correction applies, the corrected query. Otherwise, empty.
  587. string corrected_query = 4;
  588. // A unique search token. This should be included in the
  589. // [UserEvent][google.cloud.retail.v2beta.UserEvent] logs resulting from this
  590. // search, which enables accurate attribution of search model performance.
  591. string attribution_token = 5;
  592. // A token that can be sent as
  593. // [SearchRequest.page_token][google.cloud.retail.v2beta.SearchRequest.page_token]
  594. // to retrieve the next page. If this field is omitted, there are no
  595. // subsequent pages.
  596. string next_page_token = 6;
  597. // Query expansion information for the returned results.
  598. QueryExpansionInfo query_expansion_info = 7;
  599. // The URI of a customer-defined redirect page. If redirect action is
  600. // triggered, no search will be performed, and only
  601. // [redirect_uri][google.cloud.retail.v2beta.SearchResponse.redirect_uri] and
  602. // [attribution_token][google.cloud.retail.v2beta.SearchResponse.attribution_token]
  603. // will be set in the response.
  604. string redirect_uri = 10;
  605. }