search_service.proto 27 KB

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