Class: Google::Cloud::Retail::V2::Rule

Inherits:
Object
  • Object
show all
Extended by:
Protobuf::MessageExts::ClassMethods
Includes:
Protobuf::MessageExts
Defined in:
proto_docs/google/cloud/retail/v2/common.rb

Overview

A rule is a condition-action pair

  • A condition defines when a rule is to be triggered.
  • An action specifies what occurs on that trigger. Currently rules only work for controls with SOLUTION_TYPE_SEARCH.

Defined Under Namespace

Classes: BoostAction, DoNotAssociateAction, FilterAction, ForceReturnFacetAction, IgnoreAction, OnewaySynonymsAction, PinAction, RedirectAction, RemoveFacetAction, ReplacementAction, TwowaySynonymsAction

Instance Attribute Summary collapse

Instance Attribute Details

#boost_action::Google::Cloud::Retail::V2::Rule::BoostAction

Returns A boost action.

Note: The following fields are mutually exclusive: boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, replacement_action, ignore_action, filter_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.

Returns:

  • (::Google::Cloud::Retail::V2::Rule::BoostAction)

    A boost action.

    Note: The following fields are mutually exclusive: boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, replacement_action, ignore_action, filter_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 148

class Rule
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # A boost action to apply to results matching condition specified above.
  # @!attribute [rw] boost
  #   @return [::Float]
  #     Strength of the condition boost, which must be in [-1, 1]. Negative
  #     boost means demotion. Default is 0.0.
  #
  #     Setting to 1.0 gives the item a big promotion. However, it does not
  #     necessarily mean that the boosted item will be the top result at all
  #     times, nor that other items will be excluded. Results could still be
  #     shown even when none of them matches the condition. And results that
  #     are significantly more relevant to the search query can still trump
  #     your heavily favored but irrelevant items.
  #
  #     Setting to -1.0 gives the item a big demotion. However, results that
  #     are deeply relevant might still be shown. The item will have an
  #     upstream battle to get a fairly high ranking, but it is not blocked out
  #     completely.
  #
  #     Setting to 0.0 means no boost applied. The boosting condition is
  #     ignored.
  # @!attribute [rw] products_filter
  #   @return [::String]
  #     The filter can have a max size of 5000 characters.
  #     An expression which specifies which products to apply an action to.
  #     The syntax and supported fields are the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations.
  #
  #     Examples:
  #
  #     * To boost products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class BoostAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # * Rule Condition:
  #     - No
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided is a global match.
  #     - 1 or more
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided are combined with OR operator.
  #
  # * Action Input: The request query and filter that are applied to the
  # retrieved products, in addition to any filters already provided with the
  # SearchRequest. The AND operator is used to combine the query's existing
  # filters with the filter rule(s). NOTE: May result in 0 results when
  # filters conflict.
  #
  # * Action Result: Filters the returned objects to be ONLY those that passed
  # the filter.
  # @!attribute [rw] filter
  #   @return [::String]
  #     A filter to apply on the matching condition results. Supported features:
  #
  #     * {::Google::Cloud::Retail::V2::Rule::FilterAction#filter filter} must be set.
  #     * Filter syntax is identical to
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. For
  #     more
  #       information, see [Filter](/retail/docs/filter-and-order#filter).
  #     * To filter products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class FilterAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Redirects a shopper to a specific page.
  #
  # * Rule Condition:
  #   Must specify
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}.
  # * Action Input: Request Query
  # * Action Result: Redirects shopper to provided uri.
  # @!attribute [rw] redirect_uri
  #   @return [::String]
  #     URL must have length equal or less than 2000 characters.
  class RedirectAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Creates a set of terms that will be treated as synonyms of each other.
  # Example: synonyms of "sneakers" and "shoes":
  #
  #  * "sneakers" will use a synonym of "shoes".
  #  * "shoes" will use a synonym of "sneakers".
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Can specify up to 100 synonyms.
  #     Must specify at least 2 synonyms.
  class TwowaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Maps a set of terms to a set of synonyms.
  # Set of synonyms will be treated as synonyms of each query term only.
  # `query_terms` will not be treated as synonyms of each other.
  # Example: "sneakers" will use a synonym of "shoes".
  # "shoes" will not use a synonym of "sneakers".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will treat synonyms as their synonyms.
  #     Not themselves synonyms of the synonyms.
  #     Can specify up to 100 terms.
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Cannot contain duplicates.
  #     Can specify up to 100 synonyms.
  # @!attribute [rw] oneway_terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class OnewaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents `query_term` from being associated with specified terms during
  # search.
  # Example: Don't associate "gShoe" and "cheap".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will not consider do_not_associate_terms for search if in search query.
  #     Can specify up to 100 terms.
  # @!attribute [rw] do_not_associate_terms
  #   @return [::Array<::String>]
  #     Cannot contain duplicates or the query term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class DoNotAssociateAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Replaces a term in the query. Multiple replacement candidates can be
  # specified. All `query_terms` will be replaced with the replacement term.
  # Example: Replace "gShoe" with "google shoe".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will be replaced by replacement term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] replacement_term
  #   @return [::String]
  #     Term that will be used for replacement.
  # @!attribute [rw] term
  #   @return [::String]
  #     Will be [deprecated = true] post migration;
  class ReplacementAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents a term in the query from being used in search.
  # Example: Don't search for "shoddy".
  # @!attribute [rw] ignore_terms
  #   @return [::Array<::String>]
  #     Terms to ignore in the search query.
  class IgnoreAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Force returns an attribute/facet in the request around a certain position
  # or above.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Inputs: attribute name, position
  #
  # * Action Result: Will force return a facet key around a certain position
  # or above if the condition is satisfied.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes", the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#attribute_name ForceReturnFacetAction.FacetPositionAdjustment.attribute_name}
  # is "size" and the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#position ForceReturnFacetAction.FacetPositionAdjustment.position}
  # is 8.
  #
  # Two cases: a) The facet key "size" is not already in the top 8 slots, then
  # the facet "size" will appear at a position close to 8. b) The facet key
  # "size" in among the top 8 positions in the request, then it will stay at
  # its current rank.
  # @!attribute [rw] facet_position_adjustments
  #   @return [::Array<::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment>]
  #     Each instance corresponds to a force return attribute for the given
  #     condition. There can't be more 15 instances here.
  class ForceReturnFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Each facet position adjustment consists of a single attribute name (i.e.
    # facet key) along with a specified position.
    # @!attribute [rw] attribute_name
    #   @return [::String]
    #     The attribute name to force return as a facet. Each attribute name
    #     should be a valid attribute name, be non-empty and contain at most 80
    #     characters long.
    # @!attribute [rw] position
    #   @return [::Integer]
    #     This is the position in the request as explained above. It should be
    #     strictly positive be at most 100.
    class FacetPositionAdjustment
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Removes an attribute/facet in the request if is present.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: attribute name
  #
  # * Action Result: Will remove the attribute (as a facet) from the request
  # if it is present.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes" and the attribute name "size", then facet key "size" will be
  # removed from the request (if it is present).
  # @!attribute [rw] attribute_names
  #   @return [::Array<::String>]
  #     The attribute names (i.e. facet keys) to remove from the dynamic facets
  #     (if present in the request). There can't be more 3 attribute names.
  #     Each attribute name should be a valid attribute name, be non-empty and
  #     contain at most 80 characters.
  class RemoveFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Pins one or more specified products to a specific position in the
  # results.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
  # uses 1-based indexing).
  #
  # * Action Result: Will pin products with matching ids to the position
  # specified in the final result order.
  #
  # Example: Suppose the query is `shoes`, the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
  # pinned to the top position in the final results.
  #
  # If multiple PinActions are matched to a single request the actions will
  # be processed from most to least recently updated.
  #
  # Pins to positions larger than the max allowed page size of 120 are not
  # allowed.
  # @!attribute [rw] pin_map
  #   @return [::Google::Protobuf::Map{::Integer => ::String}]
  #     Required. A map of positions to product_ids.
  #
  #     Partial matches per action are allowed, if a certain position in the map
  #     is already filled that `[position, product_id]` pair will be ignored
  #     but the rest may still be applied. This case will only occur if multiple
  #     pin actions are matched to a single request, as the map guarantees that
  #     pin positions are unique within the same action.
  #
  #     Duplicate product_ids are not permitted within a single pin map.
  #
  #     The max size of this map is 120, equivalent to the max [request page
  #     size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
  class PinAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # @!attribute [rw] key
    #   @return [::Integer]
    # @!attribute [rw] value
    #   @return [::String]
    class PinMapEntry
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#condition::Google::Cloud::Retail::V2::Condition

Returns Required. The condition that triggers the rule. If the condition is empty, the rule will always apply.

Returns:



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 148

class Rule
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # A boost action to apply to results matching condition specified above.
  # @!attribute [rw] boost
  #   @return [::Float]
  #     Strength of the condition boost, which must be in [-1, 1]. Negative
  #     boost means demotion. Default is 0.0.
  #
  #     Setting to 1.0 gives the item a big promotion. However, it does not
  #     necessarily mean that the boosted item will be the top result at all
  #     times, nor that other items will be excluded. Results could still be
  #     shown even when none of them matches the condition. And results that
  #     are significantly more relevant to the search query can still trump
  #     your heavily favored but irrelevant items.
  #
  #     Setting to -1.0 gives the item a big demotion. However, results that
  #     are deeply relevant might still be shown. The item will have an
  #     upstream battle to get a fairly high ranking, but it is not blocked out
  #     completely.
  #
  #     Setting to 0.0 means no boost applied. The boosting condition is
  #     ignored.
  # @!attribute [rw] products_filter
  #   @return [::String]
  #     The filter can have a max size of 5000 characters.
  #     An expression which specifies which products to apply an action to.
  #     The syntax and supported fields are the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations.
  #
  #     Examples:
  #
  #     * To boost products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class BoostAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # * Rule Condition:
  #     - No
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided is a global match.
  #     - 1 or more
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided are combined with OR operator.
  #
  # * Action Input: The request query and filter that are applied to the
  # retrieved products, in addition to any filters already provided with the
  # SearchRequest. The AND operator is used to combine the query's existing
  # filters with the filter rule(s). NOTE: May result in 0 results when
  # filters conflict.
  #
  # * Action Result: Filters the returned objects to be ONLY those that passed
  # the filter.
  # @!attribute [rw] filter
  #   @return [::String]
  #     A filter to apply on the matching condition results. Supported features:
  #
  #     * {::Google::Cloud::Retail::V2::Rule::FilterAction#filter filter} must be set.
  #     * Filter syntax is identical to
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. For
  #     more
  #       information, see [Filter](/retail/docs/filter-and-order#filter).
  #     * To filter products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class FilterAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Redirects a shopper to a specific page.
  #
  # * Rule Condition:
  #   Must specify
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}.
  # * Action Input: Request Query
  # * Action Result: Redirects shopper to provided uri.
  # @!attribute [rw] redirect_uri
  #   @return [::String]
  #     URL must have length equal or less than 2000 characters.
  class RedirectAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Creates a set of terms that will be treated as synonyms of each other.
  # Example: synonyms of "sneakers" and "shoes":
  #
  #  * "sneakers" will use a synonym of "shoes".
  #  * "shoes" will use a synonym of "sneakers".
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Can specify up to 100 synonyms.
  #     Must specify at least 2 synonyms.
  class TwowaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Maps a set of terms to a set of synonyms.
  # Set of synonyms will be treated as synonyms of each query term only.
  # `query_terms` will not be treated as synonyms of each other.
  # Example: "sneakers" will use a synonym of "shoes".
  # "shoes" will not use a synonym of "sneakers".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will treat synonyms as their synonyms.
  #     Not themselves synonyms of the synonyms.
  #     Can specify up to 100 terms.
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Cannot contain duplicates.
  #     Can specify up to 100 synonyms.
  # @!attribute [rw] oneway_terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class OnewaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents `query_term` from being associated with specified terms during
  # search.
  # Example: Don't associate "gShoe" and "cheap".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will not consider do_not_associate_terms for search if in search query.
  #     Can specify up to 100 terms.
  # @!attribute [rw] do_not_associate_terms
  #   @return [::Array<::String>]
  #     Cannot contain duplicates or the query term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class DoNotAssociateAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Replaces a term in the query. Multiple replacement candidates can be
  # specified. All `query_terms` will be replaced with the replacement term.
  # Example: Replace "gShoe" with "google shoe".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will be replaced by replacement term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] replacement_term
  #   @return [::String]
  #     Term that will be used for replacement.
  # @!attribute [rw] term
  #   @return [::String]
  #     Will be [deprecated = true] post migration;
  class ReplacementAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents a term in the query from being used in search.
  # Example: Don't search for "shoddy".
  # @!attribute [rw] ignore_terms
  #   @return [::Array<::String>]
  #     Terms to ignore in the search query.
  class IgnoreAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Force returns an attribute/facet in the request around a certain position
  # or above.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Inputs: attribute name, position
  #
  # * Action Result: Will force return a facet key around a certain position
  # or above if the condition is satisfied.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes", the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#attribute_name ForceReturnFacetAction.FacetPositionAdjustment.attribute_name}
  # is "size" and the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#position ForceReturnFacetAction.FacetPositionAdjustment.position}
  # is 8.
  #
  # Two cases: a) The facet key "size" is not already in the top 8 slots, then
  # the facet "size" will appear at a position close to 8. b) The facet key
  # "size" in among the top 8 positions in the request, then it will stay at
  # its current rank.
  # @!attribute [rw] facet_position_adjustments
  #   @return [::Array<::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment>]
  #     Each instance corresponds to a force return attribute for the given
  #     condition. There can't be more 15 instances here.
  class ForceReturnFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Each facet position adjustment consists of a single attribute name (i.e.
    # facet key) along with a specified position.
    # @!attribute [rw] attribute_name
    #   @return [::String]
    #     The attribute name to force return as a facet. Each attribute name
    #     should be a valid attribute name, be non-empty and contain at most 80
    #     characters long.
    # @!attribute [rw] position
    #   @return [::Integer]
    #     This is the position in the request as explained above. It should be
    #     strictly positive be at most 100.
    class FacetPositionAdjustment
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Removes an attribute/facet in the request if is present.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: attribute name
  #
  # * Action Result: Will remove the attribute (as a facet) from the request
  # if it is present.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes" and the attribute name "size", then facet key "size" will be
  # removed from the request (if it is present).
  # @!attribute [rw] attribute_names
  #   @return [::Array<::String>]
  #     The attribute names (i.e. facet keys) to remove from the dynamic facets
  #     (if present in the request). There can't be more 3 attribute names.
  #     Each attribute name should be a valid attribute name, be non-empty and
  #     contain at most 80 characters.
  class RemoveFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Pins one or more specified products to a specific position in the
  # results.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
  # uses 1-based indexing).
  #
  # * Action Result: Will pin products with matching ids to the position
  # specified in the final result order.
  #
  # Example: Suppose the query is `shoes`, the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
  # pinned to the top position in the final results.
  #
  # If multiple PinActions are matched to a single request the actions will
  # be processed from most to least recently updated.
  #
  # Pins to positions larger than the max allowed page size of 120 are not
  # allowed.
  # @!attribute [rw] pin_map
  #   @return [::Google::Protobuf::Map{::Integer => ::String}]
  #     Required. A map of positions to product_ids.
  #
  #     Partial matches per action are allowed, if a certain position in the map
  #     is already filled that `[position, product_id]` pair will be ignored
  #     but the rest may still be applied. This case will only occur if multiple
  #     pin actions are matched to a single request, as the map guarantees that
  #     pin positions are unique within the same action.
  #
  #     Duplicate product_ids are not permitted within a single pin map.
  #
  #     The max size of this map is 120, equivalent to the max [request page
  #     size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
  class PinAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # @!attribute [rw] key
    #   @return [::Integer]
    # @!attribute [rw] value
    #   @return [::String]
    class PinMapEntry
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#do_not_associate_action::Google::Cloud::Retail::V2::Rule::DoNotAssociateAction

Returns Prevents term from being associated with other terms.

Note: The following fields are mutually exclusive: do_not_associate_action, boost_action, redirect_action, oneway_synonyms_action, replacement_action, ignore_action, filter_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.

Returns:

  • (::Google::Cloud::Retail::V2::Rule::DoNotAssociateAction)

    Prevents term from being associated with other terms.

    Note: The following fields are mutually exclusive: do_not_associate_action, boost_action, redirect_action, oneway_synonyms_action, replacement_action, ignore_action, filter_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 148

class Rule
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # A boost action to apply to results matching condition specified above.
  # @!attribute [rw] boost
  #   @return [::Float]
  #     Strength of the condition boost, which must be in [-1, 1]. Negative
  #     boost means demotion. Default is 0.0.
  #
  #     Setting to 1.0 gives the item a big promotion. However, it does not
  #     necessarily mean that the boosted item will be the top result at all
  #     times, nor that other items will be excluded. Results could still be
  #     shown even when none of them matches the condition. And results that
  #     are significantly more relevant to the search query can still trump
  #     your heavily favored but irrelevant items.
  #
  #     Setting to -1.0 gives the item a big demotion. However, results that
  #     are deeply relevant might still be shown. The item will have an
  #     upstream battle to get a fairly high ranking, but it is not blocked out
  #     completely.
  #
  #     Setting to 0.0 means no boost applied. The boosting condition is
  #     ignored.
  # @!attribute [rw] products_filter
  #   @return [::String]
  #     The filter can have a max size of 5000 characters.
  #     An expression which specifies which products to apply an action to.
  #     The syntax and supported fields are the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations.
  #
  #     Examples:
  #
  #     * To boost products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class BoostAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # * Rule Condition:
  #     - No
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided is a global match.
  #     - 1 or more
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided are combined with OR operator.
  #
  # * Action Input: The request query and filter that are applied to the
  # retrieved products, in addition to any filters already provided with the
  # SearchRequest. The AND operator is used to combine the query's existing
  # filters with the filter rule(s). NOTE: May result in 0 results when
  # filters conflict.
  #
  # * Action Result: Filters the returned objects to be ONLY those that passed
  # the filter.
  # @!attribute [rw] filter
  #   @return [::String]
  #     A filter to apply on the matching condition results. Supported features:
  #
  #     * {::Google::Cloud::Retail::V2::Rule::FilterAction#filter filter} must be set.
  #     * Filter syntax is identical to
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. For
  #     more
  #       information, see [Filter](/retail/docs/filter-and-order#filter).
  #     * To filter products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class FilterAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Redirects a shopper to a specific page.
  #
  # * Rule Condition:
  #   Must specify
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}.
  # * Action Input: Request Query
  # * Action Result: Redirects shopper to provided uri.
  # @!attribute [rw] redirect_uri
  #   @return [::String]
  #     URL must have length equal or less than 2000 characters.
  class RedirectAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Creates a set of terms that will be treated as synonyms of each other.
  # Example: synonyms of "sneakers" and "shoes":
  #
  #  * "sneakers" will use a synonym of "shoes".
  #  * "shoes" will use a synonym of "sneakers".
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Can specify up to 100 synonyms.
  #     Must specify at least 2 synonyms.
  class TwowaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Maps a set of terms to a set of synonyms.
  # Set of synonyms will be treated as synonyms of each query term only.
  # `query_terms` will not be treated as synonyms of each other.
  # Example: "sneakers" will use a synonym of "shoes".
  # "shoes" will not use a synonym of "sneakers".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will treat synonyms as their synonyms.
  #     Not themselves synonyms of the synonyms.
  #     Can specify up to 100 terms.
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Cannot contain duplicates.
  #     Can specify up to 100 synonyms.
  # @!attribute [rw] oneway_terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class OnewaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents `query_term` from being associated with specified terms during
  # search.
  # Example: Don't associate "gShoe" and "cheap".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will not consider do_not_associate_terms for search if in search query.
  #     Can specify up to 100 terms.
  # @!attribute [rw] do_not_associate_terms
  #   @return [::Array<::String>]
  #     Cannot contain duplicates or the query term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class DoNotAssociateAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Replaces a term in the query. Multiple replacement candidates can be
  # specified. All `query_terms` will be replaced with the replacement term.
  # Example: Replace "gShoe" with "google shoe".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will be replaced by replacement term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] replacement_term
  #   @return [::String]
  #     Term that will be used for replacement.
  # @!attribute [rw] term
  #   @return [::String]
  #     Will be [deprecated = true] post migration;
  class ReplacementAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents a term in the query from being used in search.
  # Example: Don't search for "shoddy".
  # @!attribute [rw] ignore_terms
  #   @return [::Array<::String>]
  #     Terms to ignore in the search query.
  class IgnoreAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Force returns an attribute/facet in the request around a certain position
  # or above.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Inputs: attribute name, position
  #
  # * Action Result: Will force return a facet key around a certain position
  # or above if the condition is satisfied.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes", the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#attribute_name ForceReturnFacetAction.FacetPositionAdjustment.attribute_name}
  # is "size" and the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#position ForceReturnFacetAction.FacetPositionAdjustment.position}
  # is 8.
  #
  # Two cases: a) The facet key "size" is not already in the top 8 slots, then
  # the facet "size" will appear at a position close to 8. b) The facet key
  # "size" in among the top 8 positions in the request, then it will stay at
  # its current rank.
  # @!attribute [rw] facet_position_adjustments
  #   @return [::Array<::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment>]
  #     Each instance corresponds to a force return attribute for the given
  #     condition. There can't be more 15 instances here.
  class ForceReturnFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Each facet position adjustment consists of a single attribute name (i.e.
    # facet key) along with a specified position.
    # @!attribute [rw] attribute_name
    #   @return [::String]
    #     The attribute name to force return as a facet. Each attribute name
    #     should be a valid attribute name, be non-empty and contain at most 80
    #     characters long.
    # @!attribute [rw] position
    #   @return [::Integer]
    #     This is the position in the request as explained above. It should be
    #     strictly positive be at most 100.
    class FacetPositionAdjustment
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Removes an attribute/facet in the request if is present.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: attribute name
  #
  # * Action Result: Will remove the attribute (as a facet) from the request
  # if it is present.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes" and the attribute name "size", then facet key "size" will be
  # removed from the request (if it is present).
  # @!attribute [rw] attribute_names
  #   @return [::Array<::String>]
  #     The attribute names (i.e. facet keys) to remove from the dynamic facets
  #     (if present in the request). There can't be more 3 attribute names.
  #     Each attribute name should be a valid attribute name, be non-empty and
  #     contain at most 80 characters.
  class RemoveFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Pins one or more specified products to a specific position in the
  # results.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
  # uses 1-based indexing).
  #
  # * Action Result: Will pin products with matching ids to the position
  # specified in the final result order.
  #
  # Example: Suppose the query is `shoes`, the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
  # pinned to the top position in the final results.
  #
  # If multiple PinActions are matched to a single request the actions will
  # be processed from most to least recently updated.
  #
  # Pins to positions larger than the max allowed page size of 120 are not
  # allowed.
  # @!attribute [rw] pin_map
  #   @return [::Google::Protobuf::Map{::Integer => ::String}]
  #     Required. A map of positions to product_ids.
  #
  #     Partial matches per action are allowed, if a certain position in the map
  #     is already filled that `[position, product_id]` pair will be ignored
  #     but the rest may still be applied. This case will only occur if multiple
  #     pin actions are matched to a single request, as the map guarantees that
  #     pin positions are unique within the same action.
  #
  #     Duplicate product_ids are not permitted within a single pin map.
  #
  #     The max size of this map is 120, equivalent to the max [request page
  #     size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
  class PinAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # @!attribute [rw] key
    #   @return [::Integer]
    # @!attribute [rw] value
    #   @return [::String]
    class PinMapEntry
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#filter_action::Google::Cloud::Retail::V2::Rule::FilterAction

Returns Filters results.

Note: The following fields are mutually exclusive: filter_action, boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, replacement_action, ignore_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.

Returns:

  • (::Google::Cloud::Retail::V2::Rule::FilterAction)

    Filters results.

    Note: The following fields are mutually exclusive: filter_action, boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, replacement_action, ignore_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 148

class Rule
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # A boost action to apply to results matching condition specified above.
  # @!attribute [rw] boost
  #   @return [::Float]
  #     Strength of the condition boost, which must be in [-1, 1]. Negative
  #     boost means demotion. Default is 0.0.
  #
  #     Setting to 1.0 gives the item a big promotion. However, it does not
  #     necessarily mean that the boosted item will be the top result at all
  #     times, nor that other items will be excluded. Results could still be
  #     shown even when none of them matches the condition. And results that
  #     are significantly more relevant to the search query can still trump
  #     your heavily favored but irrelevant items.
  #
  #     Setting to -1.0 gives the item a big demotion. However, results that
  #     are deeply relevant might still be shown. The item will have an
  #     upstream battle to get a fairly high ranking, but it is not blocked out
  #     completely.
  #
  #     Setting to 0.0 means no boost applied. The boosting condition is
  #     ignored.
  # @!attribute [rw] products_filter
  #   @return [::String]
  #     The filter can have a max size of 5000 characters.
  #     An expression which specifies which products to apply an action to.
  #     The syntax and supported fields are the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations.
  #
  #     Examples:
  #
  #     * To boost products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class BoostAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # * Rule Condition:
  #     - No
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided is a global match.
  #     - 1 or more
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided are combined with OR operator.
  #
  # * Action Input: The request query and filter that are applied to the
  # retrieved products, in addition to any filters already provided with the
  # SearchRequest. The AND operator is used to combine the query's existing
  # filters with the filter rule(s). NOTE: May result in 0 results when
  # filters conflict.
  #
  # * Action Result: Filters the returned objects to be ONLY those that passed
  # the filter.
  # @!attribute [rw] filter
  #   @return [::String]
  #     A filter to apply on the matching condition results. Supported features:
  #
  #     * {::Google::Cloud::Retail::V2::Rule::FilterAction#filter filter} must be set.
  #     * Filter syntax is identical to
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. For
  #     more
  #       information, see [Filter](/retail/docs/filter-and-order#filter).
  #     * To filter products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class FilterAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Redirects a shopper to a specific page.
  #
  # * Rule Condition:
  #   Must specify
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}.
  # * Action Input: Request Query
  # * Action Result: Redirects shopper to provided uri.
  # @!attribute [rw] redirect_uri
  #   @return [::String]
  #     URL must have length equal or less than 2000 characters.
  class RedirectAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Creates a set of terms that will be treated as synonyms of each other.
  # Example: synonyms of "sneakers" and "shoes":
  #
  #  * "sneakers" will use a synonym of "shoes".
  #  * "shoes" will use a synonym of "sneakers".
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Can specify up to 100 synonyms.
  #     Must specify at least 2 synonyms.
  class TwowaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Maps a set of terms to a set of synonyms.
  # Set of synonyms will be treated as synonyms of each query term only.
  # `query_terms` will not be treated as synonyms of each other.
  # Example: "sneakers" will use a synonym of "shoes".
  # "shoes" will not use a synonym of "sneakers".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will treat synonyms as their synonyms.
  #     Not themselves synonyms of the synonyms.
  #     Can specify up to 100 terms.
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Cannot contain duplicates.
  #     Can specify up to 100 synonyms.
  # @!attribute [rw] oneway_terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class OnewaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents `query_term` from being associated with specified terms during
  # search.
  # Example: Don't associate "gShoe" and "cheap".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will not consider do_not_associate_terms for search if in search query.
  #     Can specify up to 100 terms.
  # @!attribute [rw] do_not_associate_terms
  #   @return [::Array<::String>]
  #     Cannot contain duplicates or the query term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class DoNotAssociateAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Replaces a term in the query. Multiple replacement candidates can be
  # specified. All `query_terms` will be replaced with the replacement term.
  # Example: Replace "gShoe" with "google shoe".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will be replaced by replacement term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] replacement_term
  #   @return [::String]
  #     Term that will be used for replacement.
  # @!attribute [rw] term
  #   @return [::String]
  #     Will be [deprecated = true] post migration;
  class ReplacementAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents a term in the query from being used in search.
  # Example: Don't search for "shoddy".
  # @!attribute [rw] ignore_terms
  #   @return [::Array<::String>]
  #     Terms to ignore in the search query.
  class IgnoreAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Force returns an attribute/facet in the request around a certain position
  # or above.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Inputs: attribute name, position
  #
  # * Action Result: Will force return a facet key around a certain position
  # or above if the condition is satisfied.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes", the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#attribute_name ForceReturnFacetAction.FacetPositionAdjustment.attribute_name}
  # is "size" and the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#position ForceReturnFacetAction.FacetPositionAdjustment.position}
  # is 8.
  #
  # Two cases: a) The facet key "size" is not already in the top 8 slots, then
  # the facet "size" will appear at a position close to 8. b) The facet key
  # "size" in among the top 8 positions in the request, then it will stay at
  # its current rank.
  # @!attribute [rw] facet_position_adjustments
  #   @return [::Array<::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment>]
  #     Each instance corresponds to a force return attribute for the given
  #     condition. There can't be more 15 instances here.
  class ForceReturnFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Each facet position adjustment consists of a single attribute name (i.e.
    # facet key) along with a specified position.
    # @!attribute [rw] attribute_name
    #   @return [::String]
    #     The attribute name to force return as a facet. Each attribute name
    #     should be a valid attribute name, be non-empty and contain at most 80
    #     characters long.
    # @!attribute [rw] position
    #   @return [::Integer]
    #     This is the position in the request as explained above. It should be
    #     strictly positive be at most 100.
    class FacetPositionAdjustment
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Removes an attribute/facet in the request if is present.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: attribute name
  #
  # * Action Result: Will remove the attribute (as a facet) from the request
  # if it is present.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes" and the attribute name "size", then facet key "size" will be
  # removed from the request (if it is present).
  # @!attribute [rw] attribute_names
  #   @return [::Array<::String>]
  #     The attribute names (i.e. facet keys) to remove from the dynamic facets
  #     (if present in the request). There can't be more 3 attribute names.
  #     Each attribute name should be a valid attribute name, be non-empty and
  #     contain at most 80 characters.
  class RemoveFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Pins one or more specified products to a specific position in the
  # results.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
  # uses 1-based indexing).
  #
  # * Action Result: Will pin products with matching ids to the position
  # specified in the final result order.
  #
  # Example: Suppose the query is `shoes`, the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
  # pinned to the top position in the final results.
  #
  # If multiple PinActions are matched to a single request the actions will
  # be processed from most to least recently updated.
  #
  # Pins to positions larger than the max allowed page size of 120 are not
  # allowed.
  # @!attribute [rw] pin_map
  #   @return [::Google::Protobuf::Map{::Integer => ::String}]
  #     Required. A map of positions to product_ids.
  #
  #     Partial matches per action are allowed, if a certain position in the map
  #     is already filled that `[position, product_id]` pair will be ignored
  #     but the rest may still be applied. This case will only occur if multiple
  #     pin actions are matched to a single request, as the map guarantees that
  #     pin positions are unique within the same action.
  #
  #     Duplicate product_ids are not permitted within a single pin map.
  #
  #     The max size of this map is 120, equivalent to the max [request page
  #     size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
  class PinAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # @!attribute [rw] key
    #   @return [::Integer]
    # @!attribute [rw] value
    #   @return [::String]
    class PinMapEntry
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#force_return_facet_action::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction

Returns Force returns an attribute as a facet in the request.

Note: The following fields are mutually exclusive: force_return_facet_action, boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, replacement_action, ignore_action, filter_action, twoway_synonyms_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.

Returns:

  • (::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction)

    Force returns an attribute as a facet in the request.

    Note: The following fields are mutually exclusive: force_return_facet_action, boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, replacement_action, ignore_action, filter_action, twoway_synonyms_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 148

class Rule
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # A boost action to apply to results matching condition specified above.
  # @!attribute [rw] boost
  #   @return [::Float]
  #     Strength of the condition boost, which must be in [-1, 1]. Negative
  #     boost means demotion. Default is 0.0.
  #
  #     Setting to 1.0 gives the item a big promotion. However, it does not
  #     necessarily mean that the boosted item will be the top result at all
  #     times, nor that other items will be excluded. Results could still be
  #     shown even when none of them matches the condition. And results that
  #     are significantly more relevant to the search query can still trump
  #     your heavily favored but irrelevant items.
  #
  #     Setting to -1.0 gives the item a big demotion. However, results that
  #     are deeply relevant might still be shown. The item will have an
  #     upstream battle to get a fairly high ranking, but it is not blocked out
  #     completely.
  #
  #     Setting to 0.0 means no boost applied. The boosting condition is
  #     ignored.
  # @!attribute [rw] products_filter
  #   @return [::String]
  #     The filter can have a max size of 5000 characters.
  #     An expression which specifies which products to apply an action to.
  #     The syntax and supported fields are the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations.
  #
  #     Examples:
  #
  #     * To boost products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class BoostAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # * Rule Condition:
  #     - No
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided is a global match.
  #     - 1 or more
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided are combined with OR operator.
  #
  # * Action Input: The request query and filter that are applied to the
  # retrieved products, in addition to any filters already provided with the
  # SearchRequest. The AND operator is used to combine the query's existing
  # filters with the filter rule(s). NOTE: May result in 0 results when
  # filters conflict.
  #
  # * Action Result: Filters the returned objects to be ONLY those that passed
  # the filter.
  # @!attribute [rw] filter
  #   @return [::String]
  #     A filter to apply on the matching condition results. Supported features:
  #
  #     * {::Google::Cloud::Retail::V2::Rule::FilterAction#filter filter} must be set.
  #     * Filter syntax is identical to
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. For
  #     more
  #       information, see [Filter](/retail/docs/filter-and-order#filter).
  #     * To filter products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class FilterAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Redirects a shopper to a specific page.
  #
  # * Rule Condition:
  #   Must specify
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}.
  # * Action Input: Request Query
  # * Action Result: Redirects shopper to provided uri.
  # @!attribute [rw] redirect_uri
  #   @return [::String]
  #     URL must have length equal or less than 2000 characters.
  class RedirectAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Creates a set of terms that will be treated as synonyms of each other.
  # Example: synonyms of "sneakers" and "shoes":
  #
  #  * "sneakers" will use a synonym of "shoes".
  #  * "shoes" will use a synonym of "sneakers".
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Can specify up to 100 synonyms.
  #     Must specify at least 2 synonyms.
  class TwowaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Maps a set of terms to a set of synonyms.
  # Set of synonyms will be treated as synonyms of each query term only.
  # `query_terms` will not be treated as synonyms of each other.
  # Example: "sneakers" will use a synonym of "shoes".
  # "shoes" will not use a synonym of "sneakers".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will treat synonyms as their synonyms.
  #     Not themselves synonyms of the synonyms.
  #     Can specify up to 100 terms.
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Cannot contain duplicates.
  #     Can specify up to 100 synonyms.
  # @!attribute [rw] oneway_terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class OnewaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents `query_term` from being associated with specified terms during
  # search.
  # Example: Don't associate "gShoe" and "cheap".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will not consider do_not_associate_terms for search if in search query.
  #     Can specify up to 100 terms.
  # @!attribute [rw] do_not_associate_terms
  #   @return [::Array<::String>]
  #     Cannot contain duplicates or the query term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class DoNotAssociateAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Replaces a term in the query. Multiple replacement candidates can be
  # specified. All `query_terms` will be replaced with the replacement term.
  # Example: Replace "gShoe" with "google shoe".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will be replaced by replacement term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] replacement_term
  #   @return [::String]
  #     Term that will be used for replacement.
  # @!attribute [rw] term
  #   @return [::String]
  #     Will be [deprecated = true] post migration;
  class ReplacementAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents a term in the query from being used in search.
  # Example: Don't search for "shoddy".
  # @!attribute [rw] ignore_terms
  #   @return [::Array<::String>]
  #     Terms to ignore in the search query.
  class IgnoreAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Force returns an attribute/facet in the request around a certain position
  # or above.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Inputs: attribute name, position
  #
  # * Action Result: Will force return a facet key around a certain position
  # or above if the condition is satisfied.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes", the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#attribute_name ForceReturnFacetAction.FacetPositionAdjustment.attribute_name}
  # is "size" and the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#position ForceReturnFacetAction.FacetPositionAdjustment.position}
  # is 8.
  #
  # Two cases: a) The facet key "size" is not already in the top 8 slots, then
  # the facet "size" will appear at a position close to 8. b) The facet key
  # "size" in among the top 8 positions in the request, then it will stay at
  # its current rank.
  # @!attribute [rw] facet_position_adjustments
  #   @return [::Array<::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment>]
  #     Each instance corresponds to a force return attribute for the given
  #     condition. There can't be more 15 instances here.
  class ForceReturnFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Each facet position adjustment consists of a single attribute name (i.e.
    # facet key) along with a specified position.
    # @!attribute [rw] attribute_name
    #   @return [::String]
    #     The attribute name to force return as a facet. Each attribute name
    #     should be a valid attribute name, be non-empty and contain at most 80
    #     characters long.
    # @!attribute [rw] position
    #   @return [::Integer]
    #     This is the position in the request as explained above. It should be
    #     strictly positive be at most 100.
    class FacetPositionAdjustment
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Removes an attribute/facet in the request if is present.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: attribute name
  #
  # * Action Result: Will remove the attribute (as a facet) from the request
  # if it is present.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes" and the attribute name "size", then facet key "size" will be
  # removed from the request (if it is present).
  # @!attribute [rw] attribute_names
  #   @return [::Array<::String>]
  #     The attribute names (i.e. facet keys) to remove from the dynamic facets
  #     (if present in the request). There can't be more 3 attribute names.
  #     Each attribute name should be a valid attribute name, be non-empty and
  #     contain at most 80 characters.
  class RemoveFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Pins one or more specified products to a specific position in the
  # results.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
  # uses 1-based indexing).
  #
  # * Action Result: Will pin products with matching ids to the position
  # specified in the final result order.
  #
  # Example: Suppose the query is `shoes`, the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
  # pinned to the top position in the final results.
  #
  # If multiple PinActions are matched to a single request the actions will
  # be processed from most to least recently updated.
  #
  # Pins to positions larger than the max allowed page size of 120 are not
  # allowed.
  # @!attribute [rw] pin_map
  #   @return [::Google::Protobuf::Map{::Integer => ::String}]
  #     Required. A map of positions to product_ids.
  #
  #     Partial matches per action are allowed, if a certain position in the map
  #     is already filled that `[position, product_id]` pair will be ignored
  #     but the rest may still be applied. This case will only occur if multiple
  #     pin actions are matched to a single request, as the map guarantees that
  #     pin positions are unique within the same action.
  #
  #     Duplicate product_ids are not permitted within a single pin map.
  #
  #     The max size of this map is 120, equivalent to the max [request page
  #     size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
  class PinAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # @!attribute [rw] key
    #   @return [::Integer]
    # @!attribute [rw] value
    #   @return [::String]
    class PinMapEntry
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#ignore_action::Google::Cloud::Retail::V2::Rule::IgnoreAction

Returns Ignores specific terms from query during search.

Note: The following fields are mutually exclusive: ignore_action, boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, replacement_action, filter_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.

Returns:

  • (::Google::Cloud::Retail::V2::Rule::IgnoreAction)

    Ignores specific terms from query during search.

    Note: The following fields are mutually exclusive: ignore_action, boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, replacement_action, filter_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 148

class Rule
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # A boost action to apply to results matching condition specified above.
  # @!attribute [rw] boost
  #   @return [::Float]
  #     Strength of the condition boost, which must be in [-1, 1]. Negative
  #     boost means demotion. Default is 0.0.
  #
  #     Setting to 1.0 gives the item a big promotion. However, it does not
  #     necessarily mean that the boosted item will be the top result at all
  #     times, nor that other items will be excluded. Results could still be
  #     shown even when none of them matches the condition. And results that
  #     are significantly more relevant to the search query can still trump
  #     your heavily favored but irrelevant items.
  #
  #     Setting to -1.0 gives the item a big demotion. However, results that
  #     are deeply relevant might still be shown. The item will have an
  #     upstream battle to get a fairly high ranking, but it is not blocked out
  #     completely.
  #
  #     Setting to 0.0 means no boost applied. The boosting condition is
  #     ignored.
  # @!attribute [rw] products_filter
  #   @return [::String]
  #     The filter can have a max size of 5000 characters.
  #     An expression which specifies which products to apply an action to.
  #     The syntax and supported fields are the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations.
  #
  #     Examples:
  #
  #     * To boost products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class BoostAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # * Rule Condition:
  #     - No
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided is a global match.
  #     - 1 or more
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided are combined with OR operator.
  #
  # * Action Input: The request query and filter that are applied to the
  # retrieved products, in addition to any filters already provided with the
  # SearchRequest. The AND operator is used to combine the query's existing
  # filters with the filter rule(s). NOTE: May result in 0 results when
  # filters conflict.
  #
  # * Action Result: Filters the returned objects to be ONLY those that passed
  # the filter.
  # @!attribute [rw] filter
  #   @return [::String]
  #     A filter to apply on the matching condition results. Supported features:
  #
  #     * {::Google::Cloud::Retail::V2::Rule::FilterAction#filter filter} must be set.
  #     * Filter syntax is identical to
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. For
  #     more
  #       information, see [Filter](/retail/docs/filter-and-order#filter).
  #     * To filter products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class FilterAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Redirects a shopper to a specific page.
  #
  # * Rule Condition:
  #   Must specify
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}.
  # * Action Input: Request Query
  # * Action Result: Redirects shopper to provided uri.
  # @!attribute [rw] redirect_uri
  #   @return [::String]
  #     URL must have length equal or less than 2000 characters.
  class RedirectAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Creates a set of terms that will be treated as synonyms of each other.
  # Example: synonyms of "sneakers" and "shoes":
  #
  #  * "sneakers" will use a synonym of "shoes".
  #  * "shoes" will use a synonym of "sneakers".
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Can specify up to 100 synonyms.
  #     Must specify at least 2 synonyms.
  class TwowaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Maps a set of terms to a set of synonyms.
  # Set of synonyms will be treated as synonyms of each query term only.
  # `query_terms` will not be treated as synonyms of each other.
  # Example: "sneakers" will use a synonym of "shoes".
  # "shoes" will not use a synonym of "sneakers".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will treat synonyms as their synonyms.
  #     Not themselves synonyms of the synonyms.
  #     Can specify up to 100 terms.
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Cannot contain duplicates.
  #     Can specify up to 100 synonyms.
  # @!attribute [rw] oneway_terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class OnewaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents `query_term` from being associated with specified terms during
  # search.
  # Example: Don't associate "gShoe" and "cheap".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will not consider do_not_associate_terms for search if in search query.
  #     Can specify up to 100 terms.
  # @!attribute [rw] do_not_associate_terms
  #   @return [::Array<::String>]
  #     Cannot contain duplicates or the query term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class DoNotAssociateAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Replaces a term in the query. Multiple replacement candidates can be
  # specified. All `query_terms` will be replaced with the replacement term.
  # Example: Replace "gShoe" with "google shoe".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will be replaced by replacement term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] replacement_term
  #   @return [::String]
  #     Term that will be used for replacement.
  # @!attribute [rw] term
  #   @return [::String]
  #     Will be [deprecated = true] post migration;
  class ReplacementAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents a term in the query from being used in search.
  # Example: Don't search for "shoddy".
  # @!attribute [rw] ignore_terms
  #   @return [::Array<::String>]
  #     Terms to ignore in the search query.
  class IgnoreAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Force returns an attribute/facet in the request around a certain position
  # or above.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Inputs: attribute name, position
  #
  # * Action Result: Will force return a facet key around a certain position
  # or above if the condition is satisfied.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes", the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#attribute_name ForceReturnFacetAction.FacetPositionAdjustment.attribute_name}
  # is "size" and the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#position ForceReturnFacetAction.FacetPositionAdjustment.position}
  # is 8.
  #
  # Two cases: a) The facet key "size" is not already in the top 8 slots, then
  # the facet "size" will appear at a position close to 8. b) The facet key
  # "size" in among the top 8 positions in the request, then it will stay at
  # its current rank.
  # @!attribute [rw] facet_position_adjustments
  #   @return [::Array<::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment>]
  #     Each instance corresponds to a force return attribute for the given
  #     condition. There can't be more 15 instances here.
  class ForceReturnFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Each facet position adjustment consists of a single attribute name (i.e.
    # facet key) along with a specified position.
    # @!attribute [rw] attribute_name
    #   @return [::String]
    #     The attribute name to force return as a facet. Each attribute name
    #     should be a valid attribute name, be non-empty and contain at most 80
    #     characters long.
    # @!attribute [rw] position
    #   @return [::Integer]
    #     This is the position in the request as explained above. It should be
    #     strictly positive be at most 100.
    class FacetPositionAdjustment
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Removes an attribute/facet in the request if is present.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: attribute name
  #
  # * Action Result: Will remove the attribute (as a facet) from the request
  # if it is present.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes" and the attribute name "size", then facet key "size" will be
  # removed from the request (if it is present).
  # @!attribute [rw] attribute_names
  #   @return [::Array<::String>]
  #     The attribute names (i.e. facet keys) to remove from the dynamic facets
  #     (if present in the request). There can't be more 3 attribute names.
  #     Each attribute name should be a valid attribute name, be non-empty and
  #     contain at most 80 characters.
  class RemoveFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Pins one or more specified products to a specific position in the
  # results.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
  # uses 1-based indexing).
  #
  # * Action Result: Will pin products with matching ids to the position
  # specified in the final result order.
  #
  # Example: Suppose the query is `shoes`, the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
  # pinned to the top position in the final results.
  #
  # If multiple PinActions are matched to a single request the actions will
  # be processed from most to least recently updated.
  #
  # Pins to positions larger than the max allowed page size of 120 are not
  # allowed.
  # @!attribute [rw] pin_map
  #   @return [::Google::Protobuf::Map{::Integer => ::String}]
  #     Required. A map of positions to product_ids.
  #
  #     Partial matches per action are allowed, if a certain position in the map
  #     is already filled that `[position, product_id]` pair will be ignored
  #     but the rest may still be applied. This case will only occur if multiple
  #     pin actions are matched to a single request, as the map guarantees that
  #     pin positions are unique within the same action.
  #
  #     Duplicate product_ids are not permitted within a single pin map.
  #
  #     The max size of this map is 120, equivalent to the max [request page
  #     size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
  class PinAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # @!attribute [rw] key
    #   @return [::Integer]
    # @!attribute [rw] value
    #   @return [::String]
    class PinMapEntry
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#oneway_synonyms_action::Google::Cloud::Retail::V2::Rule::OnewaySynonymsAction

Returns Treats specific term as a synonym with a group of terms. Group of terms will not be treated as synonyms with the specific term.

Note: The following fields are mutually exclusive: oneway_synonyms_action, boost_action, redirect_action, do_not_associate_action, replacement_action, ignore_action, filter_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.

Returns:

  • (::Google::Cloud::Retail::V2::Rule::OnewaySynonymsAction)

    Treats specific term as a synonym with a group of terms. Group of terms will not be treated as synonyms with the specific term.

    Note: The following fields are mutually exclusive: oneway_synonyms_action, boost_action, redirect_action, do_not_associate_action, replacement_action, ignore_action, filter_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 148

class Rule
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # A boost action to apply to results matching condition specified above.
  # @!attribute [rw] boost
  #   @return [::Float]
  #     Strength of the condition boost, which must be in [-1, 1]. Negative
  #     boost means demotion. Default is 0.0.
  #
  #     Setting to 1.0 gives the item a big promotion. However, it does not
  #     necessarily mean that the boosted item will be the top result at all
  #     times, nor that other items will be excluded. Results could still be
  #     shown even when none of them matches the condition. And results that
  #     are significantly more relevant to the search query can still trump
  #     your heavily favored but irrelevant items.
  #
  #     Setting to -1.0 gives the item a big demotion. However, results that
  #     are deeply relevant might still be shown. The item will have an
  #     upstream battle to get a fairly high ranking, but it is not blocked out
  #     completely.
  #
  #     Setting to 0.0 means no boost applied. The boosting condition is
  #     ignored.
  # @!attribute [rw] products_filter
  #   @return [::String]
  #     The filter can have a max size of 5000 characters.
  #     An expression which specifies which products to apply an action to.
  #     The syntax and supported fields are the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations.
  #
  #     Examples:
  #
  #     * To boost products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class BoostAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # * Rule Condition:
  #     - No
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided is a global match.
  #     - 1 or more
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided are combined with OR operator.
  #
  # * Action Input: The request query and filter that are applied to the
  # retrieved products, in addition to any filters already provided with the
  # SearchRequest. The AND operator is used to combine the query's existing
  # filters with the filter rule(s). NOTE: May result in 0 results when
  # filters conflict.
  #
  # * Action Result: Filters the returned objects to be ONLY those that passed
  # the filter.
  # @!attribute [rw] filter
  #   @return [::String]
  #     A filter to apply on the matching condition results. Supported features:
  #
  #     * {::Google::Cloud::Retail::V2::Rule::FilterAction#filter filter} must be set.
  #     * Filter syntax is identical to
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. For
  #     more
  #       information, see [Filter](/retail/docs/filter-and-order#filter).
  #     * To filter products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class FilterAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Redirects a shopper to a specific page.
  #
  # * Rule Condition:
  #   Must specify
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}.
  # * Action Input: Request Query
  # * Action Result: Redirects shopper to provided uri.
  # @!attribute [rw] redirect_uri
  #   @return [::String]
  #     URL must have length equal or less than 2000 characters.
  class RedirectAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Creates a set of terms that will be treated as synonyms of each other.
  # Example: synonyms of "sneakers" and "shoes":
  #
  #  * "sneakers" will use a synonym of "shoes".
  #  * "shoes" will use a synonym of "sneakers".
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Can specify up to 100 synonyms.
  #     Must specify at least 2 synonyms.
  class TwowaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Maps a set of terms to a set of synonyms.
  # Set of synonyms will be treated as synonyms of each query term only.
  # `query_terms` will not be treated as synonyms of each other.
  # Example: "sneakers" will use a synonym of "shoes".
  # "shoes" will not use a synonym of "sneakers".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will treat synonyms as their synonyms.
  #     Not themselves synonyms of the synonyms.
  #     Can specify up to 100 terms.
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Cannot contain duplicates.
  #     Can specify up to 100 synonyms.
  # @!attribute [rw] oneway_terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class OnewaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents `query_term` from being associated with specified terms during
  # search.
  # Example: Don't associate "gShoe" and "cheap".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will not consider do_not_associate_terms for search if in search query.
  #     Can specify up to 100 terms.
  # @!attribute [rw] do_not_associate_terms
  #   @return [::Array<::String>]
  #     Cannot contain duplicates or the query term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class DoNotAssociateAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Replaces a term in the query. Multiple replacement candidates can be
  # specified. All `query_terms` will be replaced with the replacement term.
  # Example: Replace "gShoe" with "google shoe".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will be replaced by replacement term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] replacement_term
  #   @return [::String]
  #     Term that will be used for replacement.
  # @!attribute [rw] term
  #   @return [::String]
  #     Will be [deprecated = true] post migration;
  class ReplacementAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents a term in the query from being used in search.
  # Example: Don't search for "shoddy".
  # @!attribute [rw] ignore_terms
  #   @return [::Array<::String>]
  #     Terms to ignore in the search query.
  class IgnoreAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Force returns an attribute/facet in the request around a certain position
  # or above.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Inputs: attribute name, position
  #
  # * Action Result: Will force return a facet key around a certain position
  # or above if the condition is satisfied.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes", the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#attribute_name ForceReturnFacetAction.FacetPositionAdjustment.attribute_name}
  # is "size" and the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#position ForceReturnFacetAction.FacetPositionAdjustment.position}
  # is 8.
  #
  # Two cases: a) The facet key "size" is not already in the top 8 slots, then
  # the facet "size" will appear at a position close to 8. b) The facet key
  # "size" in among the top 8 positions in the request, then it will stay at
  # its current rank.
  # @!attribute [rw] facet_position_adjustments
  #   @return [::Array<::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment>]
  #     Each instance corresponds to a force return attribute for the given
  #     condition. There can't be more 15 instances here.
  class ForceReturnFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Each facet position adjustment consists of a single attribute name (i.e.
    # facet key) along with a specified position.
    # @!attribute [rw] attribute_name
    #   @return [::String]
    #     The attribute name to force return as a facet. Each attribute name
    #     should be a valid attribute name, be non-empty and contain at most 80
    #     characters long.
    # @!attribute [rw] position
    #   @return [::Integer]
    #     This is the position in the request as explained above. It should be
    #     strictly positive be at most 100.
    class FacetPositionAdjustment
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Removes an attribute/facet in the request if is present.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: attribute name
  #
  # * Action Result: Will remove the attribute (as a facet) from the request
  # if it is present.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes" and the attribute name "size", then facet key "size" will be
  # removed from the request (if it is present).
  # @!attribute [rw] attribute_names
  #   @return [::Array<::String>]
  #     The attribute names (i.e. facet keys) to remove from the dynamic facets
  #     (if present in the request). There can't be more 3 attribute names.
  #     Each attribute name should be a valid attribute name, be non-empty and
  #     contain at most 80 characters.
  class RemoveFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Pins one or more specified products to a specific position in the
  # results.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
  # uses 1-based indexing).
  #
  # * Action Result: Will pin products with matching ids to the position
  # specified in the final result order.
  #
  # Example: Suppose the query is `shoes`, the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
  # pinned to the top position in the final results.
  #
  # If multiple PinActions are matched to a single request the actions will
  # be processed from most to least recently updated.
  #
  # Pins to positions larger than the max allowed page size of 120 are not
  # allowed.
  # @!attribute [rw] pin_map
  #   @return [::Google::Protobuf::Map{::Integer => ::String}]
  #     Required. A map of positions to product_ids.
  #
  #     Partial matches per action are allowed, if a certain position in the map
  #     is already filled that `[position, product_id]` pair will be ignored
  #     but the rest may still be applied. This case will only occur if multiple
  #     pin actions are matched to a single request, as the map guarantees that
  #     pin positions are unique within the same action.
  #
  #     Duplicate product_ids are not permitted within a single pin map.
  #
  #     The max size of this map is 120, equivalent to the max [request page
  #     size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
  class PinAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # @!attribute [rw] key
    #   @return [::Integer]
    # @!attribute [rw] value
    #   @return [::String]
    class PinMapEntry
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#pin_action::Google::Cloud::Retail::V2::Rule::PinAction

Returns Pins one or more specified products to a specific position in the results.

Note: The following fields are mutually exclusive: pin_action, boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, replacement_action, ignore_action, filter_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action. If a field in that set is populated, all other fields in the set will automatically be cleared.

Returns:

  • (::Google::Cloud::Retail::V2::Rule::PinAction)

    Pins one or more specified products to a specific position in the results.

    Note: The following fields are mutually exclusive: pin_action, boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, replacement_action, ignore_action, filter_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action. If a field in that set is populated, all other fields in the set will automatically be cleared.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 148

class Rule
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # A boost action to apply to results matching condition specified above.
  # @!attribute [rw] boost
  #   @return [::Float]
  #     Strength of the condition boost, which must be in [-1, 1]. Negative
  #     boost means demotion. Default is 0.0.
  #
  #     Setting to 1.0 gives the item a big promotion. However, it does not
  #     necessarily mean that the boosted item will be the top result at all
  #     times, nor that other items will be excluded. Results could still be
  #     shown even when none of them matches the condition. And results that
  #     are significantly more relevant to the search query can still trump
  #     your heavily favored but irrelevant items.
  #
  #     Setting to -1.0 gives the item a big demotion. However, results that
  #     are deeply relevant might still be shown. The item will have an
  #     upstream battle to get a fairly high ranking, but it is not blocked out
  #     completely.
  #
  #     Setting to 0.0 means no boost applied. The boosting condition is
  #     ignored.
  # @!attribute [rw] products_filter
  #   @return [::String]
  #     The filter can have a max size of 5000 characters.
  #     An expression which specifies which products to apply an action to.
  #     The syntax and supported fields are the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations.
  #
  #     Examples:
  #
  #     * To boost products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class BoostAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # * Rule Condition:
  #     - No
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided is a global match.
  #     - 1 or more
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided are combined with OR operator.
  #
  # * Action Input: The request query and filter that are applied to the
  # retrieved products, in addition to any filters already provided with the
  # SearchRequest. The AND operator is used to combine the query's existing
  # filters with the filter rule(s). NOTE: May result in 0 results when
  # filters conflict.
  #
  # * Action Result: Filters the returned objects to be ONLY those that passed
  # the filter.
  # @!attribute [rw] filter
  #   @return [::String]
  #     A filter to apply on the matching condition results. Supported features:
  #
  #     * {::Google::Cloud::Retail::V2::Rule::FilterAction#filter filter} must be set.
  #     * Filter syntax is identical to
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. For
  #     more
  #       information, see [Filter](/retail/docs/filter-and-order#filter).
  #     * To filter products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class FilterAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Redirects a shopper to a specific page.
  #
  # * Rule Condition:
  #   Must specify
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}.
  # * Action Input: Request Query
  # * Action Result: Redirects shopper to provided uri.
  # @!attribute [rw] redirect_uri
  #   @return [::String]
  #     URL must have length equal or less than 2000 characters.
  class RedirectAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Creates a set of terms that will be treated as synonyms of each other.
  # Example: synonyms of "sneakers" and "shoes":
  #
  #  * "sneakers" will use a synonym of "shoes".
  #  * "shoes" will use a synonym of "sneakers".
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Can specify up to 100 synonyms.
  #     Must specify at least 2 synonyms.
  class TwowaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Maps a set of terms to a set of synonyms.
  # Set of synonyms will be treated as synonyms of each query term only.
  # `query_terms` will not be treated as synonyms of each other.
  # Example: "sneakers" will use a synonym of "shoes".
  # "shoes" will not use a synonym of "sneakers".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will treat synonyms as their synonyms.
  #     Not themselves synonyms of the synonyms.
  #     Can specify up to 100 terms.
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Cannot contain duplicates.
  #     Can specify up to 100 synonyms.
  # @!attribute [rw] oneway_terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class OnewaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents `query_term` from being associated with specified terms during
  # search.
  # Example: Don't associate "gShoe" and "cheap".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will not consider do_not_associate_terms for search if in search query.
  #     Can specify up to 100 terms.
  # @!attribute [rw] do_not_associate_terms
  #   @return [::Array<::String>]
  #     Cannot contain duplicates or the query term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class DoNotAssociateAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Replaces a term in the query. Multiple replacement candidates can be
  # specified. All `query_terms` will be replaced with the replacement term.
  # Example: Replace "gShoe" with "google shoe".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will be replaced by replacement term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] replacement_term
  #   @return [::String]
  #     Term that will be used for replacement.
  # @!attribute [rw] term
  #   @return [::String]
  #     Will be [deprecated = true] post migration;
  class ReplacementAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents a term in the query from being used in search.
  # Example: Don't search for "shoddy".
  # @!attribute [rw] ignore_terms
  #   @return [::Array<::String>]
  #     Terms to ignore in the search query.
  class IgnoreAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Force returns an attribute/facet in the request around a certain position
  # or above.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Inputs: attribute name, position
  #
  # * Action Result: Will force return a facet key around a certain position
  # or above if the condition is satisfied.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes", the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#attribute_name ForceReturnFacetAction.FacetPositionAdjustment.attribute_name}
  # is "size" and the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#position ForceReturnFacetAction.FacetPositionAdjustment.position}
  # is 8.
  #
  # Two cases: a) The facet key "size" is not already in the top 8 slots, then
  # the facet "size" will appear at a position close to 8. b) The facet key
  # "size" in among the top 8 positions in the request, then it will stay at
  # its current rank.
  # @!attribute [rw] facet_position_adjustments
  #   @return [::Array<::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment>]
  #     Each instance corresponds to a force return attribute for the given
  #     condition. There can't be more 15 instances here.
  class ForceReturnFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Each facet position adjustment consists of a single attribute name (i.e.
    # facet key) along with a specified position.
    # @!attribute [rw] attribute_name
    #   @return [::String]
    #     The attribute name to force return as a facet. Each attribute name
    #     should be a valid attribute name, be non-empty and contain at most 80
    #     characters long.
    # @!attribute [rw] position
    #   @return [::Integer]
    #     This is the position in the request as explained above. It should be
    #     strictly positive be at most 100.
    class FacetPositionAdjustment
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Removes an attribute/facet in the request if is present.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: attribute name
  #
  # * Action Result: Will remove the attribute (as a facet) from the request
  # if it is present.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes" and the attribute name "size", then facet key "size" will be
  # removed from the request (if it is present).
  # @!attribute [rw] attribute_names
  #   @return [::Array<::String>]
  #     The attribute names (i.e. facet keys) to remove from the dynamic facets
  #     (if present in the request). There can't be more 3 attribute names.
  #     Each attribute name should be a valid attribute name, be non-empty and
  #     contain at most 80 characters.
  class RemoveFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Pins one or more specified products to a specific position in the
  # results.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
  # uses 1-based indexing).
  #
  # * Action Result: Will pin products with matching ids to the position
  # specified in the final result order.
  #
  # Example: Suppose the query is `shoes`, the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
  # pinned to the top position in the final results.
  #
  # If multiple PinActions are matched to a single request the actions will
  # be processed from most to least recently updated.
  #
  # Pins to positions larger than the max allowed page size of 120 are not
  # allowed.
  # @!attribute [rw] pin_map
  #   @return [::Google::Protobuf::Map{::Integer => ::String}]
  #     Required. A map of positions to product_ids.
  #
  #     Partial matches per action are allowed, if a certain position in the map
  #     is already filled that `[position, product_id]` pair will be ignored
  #     but the rest may still be applied. This case will only occur if multiple
  #     pin actions are matched to a single request, as the map guarantees that
  #     pin positions are unique within the same action.
  #
  #     Duplicate product_ids are not permitted within a single pin map.
  #
  #     The max size of this map is 120, equivalent to the max [request page
  #     size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
  class PinAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # @!attribute [rw] key
    #   @return [::Integer]
    # @!attribute [rw] value
    #   @return [::String]
    class PinMapEntry
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#redirect_action::Google::Cloud::Retail::V2::Rule::RedirectAction

Returns Redirects a shopper to a specific page.

Note: The following fields are mutually exclusive: redirect_action, boost_action, oneway_synonyms_action, do_not_associate_action, replacement_action, ignore_action, filter_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.

Returns:

  • (::Google::Cloud::Retail::V2::Rule::RedirectAction)

    Redirects a shopper to a specific page.

    Note: The following fields are mutually exclusive: redirect_action, boost_action, oneway_synonyms_action, do_not_associate_action, replacement_action, ignore_action, filter_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 148

class Rule
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # A boost action to apply to results matching condition specified above.
  # @!attribute [rw] boost
  #   @return [::Float]
  #     Strength of the condition boost, which must be in [-1, 1]. Negative
  #     boost means demotion. Default is 0.0.
  #
  #     Setting to 1.0 gives the item a big promotion. However, it does not
  #     necessarily mean that the boosted item will be the top result at all
  #     times, nor that other items will be excluded. Results could still be
  #     shown even when none of them matches the condition. And results that
  #     are significantly more relevant to the search query can still trump
  #     your heavily favored but irrelevant items.
  #
  #     Setting to -1.0 gives the item a big demotion. However, results that
  #     are deeply relevant might still be shown. The item will have an
  #     upstream battle to get a fairly high ranking, but it is not blocked out
  #     completely.
  #
  #     Setting to 0.0 means no boost applied. The boosting condition is
  #     ignored.
  # @!attribute [rw] products_filter
  #   @return [::String]
  #     The filter can have a max size of 5000 characters.
  #     An expression which specifies which products to apply an action to.
  #     The syntax and supported fields are the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations.
  #
  #     Examples:
  #
  #     * To boost products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class BoostAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # * Rule Condition:
  #     - No
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided is a global match.
  #     - 1 or more
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided are combined with OR operator.
  #
  # * Action Input: The request query and filter that are applied to the
  # retrieved products, in addition to any filters already provided with the
  # SearchRequest. The AND operator is used to combine the query's existing
  # filters with the filter rule(s). NOTE: May result in 0 results when
  # filters conflict.
  #
  # * Action Result: Filters the returned objects to be ONLY those that passed
  # the filter.
  # @!attribute [rw] filter
  #   @return [::String]
  #     A filter to apply on the matching condition results. Supported features:
  #
  #     * {::Google::Cloud::Retail::V2::Rule::FilterAction#filter filter} must be set.
  #     * Filter syntax is identical to
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. For
  #     more
  #       information, see [Filter](/retail/docs/filter-and-order#filter).
  #     * To filter products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class FilterAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Redirects a shopper to a specific page.
  #
  # * Rule Condition:
  #   Must specify
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}.
  # * Action Input: Request Query
  # * Action Result: Redirects shopper to provided uri.
  # @!attribute [rw] redirect_uri
  #   @return [::String]
  #     URL must have length equal or less than 2000 characters.
  class RedirectAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Creates a set of terms that will be treated as synonyms of each other.
  # Example: synonyms of "sneakers" and "shoes":
  #
  #  * "sneakers" will use a synonym of "shoes".
  #  * "shoes" will use a synonym of "sneakers".
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Can specify up to 100 synonyms.
  #     Must specify at least 2 synonyms.
  class TwowaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Maps a set of terms to a set of synonyms.
  # Set of synonyms will be treated as synonyms of each query term only.
  # `query_terms` will not be treated as synonyms of each other.
  # Example: "sneakers" will use a synonym of "shoes".
  # "shoes" will not use a synonym of "sneakers".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will treat synonyms as their synonyms.
  #     Not themselves synonyms of the synonyms.
  #     Can specify up to 100 terms.
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Cannot contain duplicates.
  #     Can specify up to 100 synonyms.
  # @!attribute [rw] oneway_terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class OnewaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents `query_term` from being associated with specified terms during
  # search.
  # Example: Don't associate "gShoe" and "cheap".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will not consider do_not_associate_terms for search if in search query.
  #     Can specify up to 100 terms.
  # @!attribute [rw] do_not_associate_terms
  #   @return [::Array<::String>]
  #     Cannot contain duplicates or the query term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class DoNotAssociateAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Replaces a term in the query. Multiple replacement candidates can be
  # specified. All `query_terms` will be replaced with the replacement term.
  # Example: Replace "gShoe" with "google shoe".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will be replaced by replacement term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] replacement_term
  #   @return [::String]
  #     Term that will be used for replacement.
  # @!attribute [rw] term
  #   @return [::String]
  #     Will be [deprecated = true] post migration;
  class ReplacementAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents a term in the query from being used in search.
  # Example: Don't search for "shoddy".
  # @!attribute [rw] ignore_terms
  #   @return [::Array<::String>]
  #     Terms to ignore in the search query.
  class IgnoreAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Force returns an attribute/facet in the request around a certain position
  # or above.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Inputs: attribute name, position
  #
  # * Action Result: Will force return a facet key around a certain position
  # or above if the condition is satisfied.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes", the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#attribute_name ForceReturnFacetAction.FacetPositionAdjustment.attribute_name}
  # is "size" and the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#position ForceReturnFacetAction.FacetPositionAdjustment.position}
  # is 8.
  #
  # Two cases: a) The facet key "size" is not already in the top 8 slots, then
  # the facet "size" will appear at a position close to 8. b) The facet key
  # "size" in among the top 8 positions in the request, then it will stay at
  # its current rank.
  # @!attribute [rw] facet_position_adjustments
  #   @return [::Array<::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment>]
  #     Each instance corresponds to a force return attribute for the given
  #     condition. There can't be more 15 instances here.
  class ForceReturnFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Each facet position adjustment consists of a single attribute name (i.e.
    # facet key) along with a specified position.
    # @!attribute [rw] attribute_name
    #   @return [::String]
    #     The attribute name to force return as a facet. Each attribute name
    #     should be a valid attribute name, be non-empty and contain at most 80
    #     characters long.
    # @!attribute [rw] position
    #   @return [::Integer]
    #     This is the position in the request as explained above. It should be
    #     strictly positive be at most 100.
    class FacetPositionAdjustment
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Removes an attribute/facet in the request if is present.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: attribute name
  #
  # * Action Result: Will remove the attribute (as a facet) from the request
  # if it is present.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes" and the attribute name "size", then facet key "size" will be
  # removed from the request (if it is present).
  # @!attribute [rw] attribute_names
  #   @return [::Array<::String>]
  #     The attribute names (i.e. facet keys) to remove from the dynamic facets
  #     (if present in the request). There can't be more 3 attribute names.
  #     Each attribute name should be a valid attribute name, be non-empty and
  #     contain at most 80 characters.
  class RemoveFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Pins one or more specified products to a specific position in the
  # results.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
  # uses 1-based indexing).
  #
  # * Action Result: Will pin products with matching ids to the position
  # specified in the final result order.
  #
  # Example: Suppose the query is `shoes`, the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
  # pinned to the top position in the final results.
  #
  # If multiple PinActions are matched to a single request the actions will
  # be processed from most to least recently updated.
  #
  # Pins to positions larger than the max allowed page size of 120 are not
  # allowed.
  # @!attribute [rw] pin_map
  #   @return [::Google::Protobuf::Map{::Integer => ::String}]
  #     Required. A map of positions to product_ids.
  #
  #     Partial matches per action are allowed, if a certain position in the map
  #     is already filled that `[position, product_id]` pair will be ignored
  #     but the rest may still be applied. This case will only occur if multiple
  #     pin actions are matched to a single request, as the map guarantees that
  #     pin positions are unique within the same action.
  #
  #     Duplicate product_ids are not permitted within a single pin map.
  #
  #     The max size of this map is 120, equivalent to the max [request page
  #     size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
  class PinAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # @!attribute [rw] key
    #   @return [::Integer]
    # @!attribute [rw] value
    #   @return [::String]
    class PinMapEntry
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#remove_facet_action::Google::Cloud::Retail::V2::Rule::RemoveFacetAction

Returns Remove an attribute as a facet in the request (if present).

Note: The following fields are mutually exclusive: remove_facet_action, boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, replacement_action, ignore_action, filter_action, twoway_synonyms_action, force_return_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.

Returns:

  • (::Google::Cloud::Retail::V2::Rule::RemoveFacetAction)

    Remove an attribute as a facet in the request (if present).

    Note: The following fields are mutually exclusive: remove_facet_action, boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, replacement_action, ignore_action, filter_action, twoway_synonyms_action, force_return_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 148

class Rule
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # A boost action to apply to results matching condition specified above.
  # @!attribute [rw] boost
  #   @return [::Float]
  #     Strength of the condition boost, which must be in [-1, 1]. Negative
  #     boost means demotion. Default is 0.0.
  #
  #     Setting to 1.0 gives the item a big promotion. However, it does not
  #     necessarily mean that the boosted item will be the top result at all
  #     times, nor that other items will be excluded. Results could still be
  #     shown even when none of them matches the condition. And results that
  #     are significantly more relevant to the search query can still trump
  #     your heavily favored but irrelevant items.
  #
  #     Setting to -1.0 gives the item a big demotion. However, results that
  #     are deeply relevant might still be shown. The item will have an
  #     upstream battle to get a fairly high ranking, but it is not blocked out
  #     completely.
  #
  #     Setting to 0.0 means no boost applied. The boosting condition is
  #     ignored.
  # @!attribute [rw] products_filter
  #   @return [::String]
  #     The filter can have a max size of 5000 characters.
  #     An expression which specifies which products to apply an action to.
  #     The syntax and supported fields are the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations.
  #
  #     Examples:
  #
  #     * To boost products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class BoostAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # * Rule Condition:
  #     - No
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided is a global match.
  #     - 1 or more
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided are combined with OR operator.
  #
  # * Action Input: The request query and filter that are applied to the
  # retrieved products, in addition to any filters already provided with the
  # SearchRequest. The AND operator is used to combine the query's existing
  # filters with the filter rule(s). NOTE: May result in 0 results when
  # filters conflict.
  #
  # * Action Result: Filters the returned objects to be ONLY those that passed
  # the filter.
  # @!attribute [rw] filter
  #   @return [::String]
  #     A filter to apply on the matching condition results. Supported features:
  #
  #     * {::Google::Cloud::Retail::V2::Rule::FilterAction#filter filter} must be set.
  #     * Filter syntax is identical to
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. For
  #     more
  #       information, see [Filter](/retail/docs/filter-and-order#filter).
  #     * To filter products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class FilterAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Redirects a shopper to a specific page.
  #
  # * Rule Condition:
  #   Must specify
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}.
  # * Action Input: Request Query
  # * Action Result: Redirects shopper to provided uri.
  # @!attribute [rw] redirect_uri
  #   @return [::String]
  #     URL must have length equal or less than 2000 characters.
  class RedirectAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Creates a set of terms that will be treated as synonyms of each other.
  # Example: synonyms of "sneakers" and "shoes":
  #
  #  * "sneakers" will use a synonym of "shoes".
  #  * "shoes" will use a synonym of "sneakers".
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Can specify up to 100 synonyms.
  #     Must specify at least 2 synonyms.
  class TwowaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Maps a set of terms to a set of synonyms.
  # Set of synonyms will be treated as synonyms of each query term only.
  # `query_terms` will not be treated as synonyms of each other.
  # Example: "sneakers" will use a synonym of "shoes".
  # "shoes" will not use a synonym of "sneakers".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will treat synonyms as their synonyms.
  #     Not themselves synonyms of the synonyms.
  #     Can specify up to 100 terms.
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Cannot contain duplicates.
  #     Can specify up to 100 synonyms.
  # @!attribute [rw] oneway_terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class OnewaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents `query_term` from being associated with specified terms during
  # search.
  # Example: Don't associate "gShoe" and "cheap".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will not consider do_not_associate_terms for search if in search query.
  #     Can specify up to 100 terms.
  # @!attribute [rw] do_not_associate_terms
  #   @return [::Array<::String>]
  #     Cannot contain duplicates or the query term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class DoNotAssociateAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Replaces a term in the query. Multiple replacement candidates can be
  # specified. All `query_terms` will be replaced with the replacement term.
  # Example: Replace "gShoe" with "google shoe".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will be replaced by replacement term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] replacement_term
  #   @return [::String]
  #     Term that will be used for replacement.
  # @!attribute [rw] term
  #   @return [::String]
  #     Will be [deprecated = true] post migration;
  class ReplacementAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents a term in the query from being used in search.
  # Example: Don't search for "shoddy".
  # @!attribute [rw] ignore_terms
  #   @return [::Array<::String>]
  #     Terms to ignore in the search query.
  class IgnoreAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Force returns an attribute/facet in the request around a certain position
  # or above.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Inputs: attribute name, position
  #
  # * Action Result: Will force return a facet key around a certain position
  # or above if the condition is satisfied.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes", the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#attribute_name ForceReturnFacetAction.FacetPositionAdjustment.attribute_name}
  # is "size" and the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#position ForceReturnFacetAction.FacetPositionAdjustment.position}
  # is 8.
  #
  # Two cases: a) The facet key "size" is not already in the top 8 slots, then
  # the facet "size" will appear at a position close to 8. b) The facet key
  # "size" in among the top 8 positions in the request, then it will stay at
  # its current rank.
  # @!attribute [rw] facet_position_adjustments
  #   @return [::Array<::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment>]
  #     Each instance corresponds to a force return attribute for the given
  #     condition. There can't be more 15 instances here.
  class ForceReturnFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Each facet position adjustment consists of a single attribute name (i.e.
    # facet key) along with a specified position.
    # @!attribute [rw] attribute_name
    #   @return [::String]
    #     The attribute name to force return as a facet. Each attribute name
    #     should be a valid attribute name, be non-empty and contain at most 80
    #     characters long.
    # @!attribute [rw] position
    #   @return [::Integer]
    #     This is the position in the request as explained above. It should be
    #     strictly positive be at most 100.
    class FacetPositionAdjustment
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Removes an attribute/facet in the request if is present.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: attribute name
  #
  # * Action Result: Will remove the attribute (as a facet) from the request
  # if it is present.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes" and the attribute name "size", then facet key "size" will be
  # removed from the request (if it is present).
  # @!attribute [rw] attribute_names
  #   @return [::Array<::String>]
  #     The attribute names (i.e. facet keys) to remove from the dynamic facets
  #     (if present in the request). There can't be more 3 attribute names.
  #     Each attribute name should be a valid attribute name, be non-empty and
  #     contain at most 80 characters.
  class RemoveFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Pins one or more specified products to a specific position in the
  # results.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
  # uses 1-based indexing).
  #
  # * Action Result: Will pin products with matching ids to the position
  # specified in the final result order.
  #
  # Example: Suppose the query is `shoes`, the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
  # pinned to the top position in the final results.
  #
  # If multiple PinActions are matched to a single request the actions will
  # be processed from most to least recently updated.
  #
  # Pins to positions larger than the max allowed page size of 120 are not
  # allowed.
  # @!attribute [rw] pin_map
  #   @return [::Google::Protobuf::Map{::Integer => ::String}]
  #     Required. A map of positions to product_ids.
  #
  #     Partial matches per action are allowed, if a certain position in the map
  #     is already filled that `[position, product_id]` pair will be ignored
  #     but the rest may still be applied. This case will only occur if multiple
  #     pin actions are matched to a single request, as the map guarantees that
  #     pin positions are unique within the same action.
  #
  #     Duplicate product_ids are not permitted within a single pin map.
  #
  #     The max size of this map is 120, equivalent to the max [request page
  #     size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
  class PinAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # @!attribute [rw] key
    #   @return [::Integer]
    # @!attribute [rw] value
    #   @return [::String]
    class PinMapEntry
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#replacement_action::Google::Cloud::Retail::V2::Rule::ReplacementAction

Returns Replaces specific terms in the query.

Note: The following fields are mutually exclusive: replacement_action, boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, ignore_action, filter_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.

Returns:

  • (::Google::Cloud::Retail::V2::Rule::ReplacementAction)

    Replaces specific terms in the query.

    Note: The following fields are mutually exclusive: replacement_action, boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, ignore_action, filter_action, twoway_synonyms_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 148

class Rule
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # A boost action to apply to results matching condition specified above.
  # @!attribute [rw] boost
  #   @return [::Float]
  #     Strength of the condition boost, which must be in [-1, 1]. Negative
  #     boost means demotion. Default is 0.0.
  #
  #     Setting to 1.0 gives the item a big promotion. However, it does not
  #     necessarily mean that the boosted item will be the top result at all
  #     times, nor that other items will be excluded. Results could still be
  #     shown even when none of them matches the condition. And results that
  #     are significantly more relevant to the search query can still trump
  #     your heavily favored but irrelevant items.
  #
  #     Setting to -1.0 gives the item a big demotion. However, results that
  #     are deeply relevant might still be shown. The item will have an
  #     upstream battle to get a fairly high ranking, but it is not blocked out
  #     completely.
  #
  #     Setting to 0.0 means no boost applied. The boosting condition is
  #     ignored.
  # @!attribute [rw] products_filter
  #   @return [::String]
  #     The filter can have a max size of 5000 characters.
  #     An expression which specifies which products to apply an action to.
  #     The syntax and supported fields are the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations.
  #
  #     Examples:
  #
  #     * To boost products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class BoostAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # * Rule Condition:
  #     - No
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided is a global match.
  #     - 1 or more
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided are combined with OR operator.
  #
  # * Action Input: The request query and filter that are applied to the
  # retrieved products, in addition to any filters already provided with the
  # SearchRequest. The AND operator is used to combine the query's existing
  # filters with the filter rule(s). NOTE: May result in 0 results when
  # filters conflict.
  #
  # * Action Result: Filters the returned objects to be ONLY those that passed
  # the filter.
  # @!attribute [rw] filter
  #   @return [::String]
  #     A filter to apply on the matching condition results. Supported features:
  #
  #     * {::Google::Cloud::Retail::V2::Rule::FilterAction#filter filter} must be set.
  #     * Filter syntax is identical to
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. For
  #     more
  #       information, see [Filter](/retail/docs/filter-and-order#filter).
  #     * To filter products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class FilterAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Redirects a shopper to a specific page.
  #
  # * Rule Condition:
  #   Must specify
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}.
  # * Action Input: Request Query
  # * Action Result: Redirects shopper to provided uri.
  # @!attribute [rw] redirect_uri
  #   @return [::String]
  #     URL must have length equal or less than 2000 characters.
  class RedirectAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Creates a set of terms that will be treated as synonyms of each other.
  # Example: synonyms of "sneakers" and "shoes":
  #
  #  * "sneakers" will use a synonym of "shoes".
  #  * "shoes" will use a synonym of "sneakers".
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Can specify up to 100 synonyms.
  #     Must specify at least 2 synonyms.
  class TwowaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Maps a set of terms to a set of synonyms.
  # Set of synonyms will be treated as synonyms of each query term only.
  # `query_terms` will not be treated as synonyms of each other.
  # Example: "sneakers" will use a synonym of "shoes".
  # "shoes" will not use a synonym of "sneakers".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will treat synonyms as their synonyms.
  #     Not themselves synonyms of the synonyms.
  #     Can specify up to 100 terms.
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Cannot contain duplicates.
  #     Can specify up to 100 synonyms.
  # @!attribute [rw] oneway_terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class OnewaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents `query_term` from being associated with specified terms during
  # search.
  # Example: Don't associate "gShoe" and "cheap".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will not consider do_not_associate_terms for search if in search query.
  #     Can specify up to 100 terms.
  # @!attribute [rw] do_not_associate_terms
  #   @return [::Array<::String>]
  #     Cannot contain duplicates or the query term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class DoNotAssociateAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Replaces a term in the query. Multiple replacement candidates can be
  # specified. All `query_terms` will be replaced with the replacement term.
  # Example: Replace "gShoe" with "google shoe".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will be replaced by replacement term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] replacement_term
  #   @return [::String]
  #     Term that will be used for replacement.
  # @!attribute [rw] term
  #   @return [::String]
  #     Will be [deprecated = true] post migration;
  class ReplacementAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents a term in the query from being used in search.
  # Example: Don't search for "shoddy".
  # @!attribute [rw] ignore_terms
  #   @return [::Array<::String>]
  #     Terms to ignore in the search query.
  class IgnoreAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Force returns an attribute/facet in the request around a certain position
  # or above.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Inputs: attribute name, position
  #
  # * Action Result: Will force return a facet key around a certain position
  # or above if the condition is satisfied.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes", the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#attribute_name ForceReturnFacetAction.FacetPositionAdjustment.attribute_name}
  # is "size" and the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#position ForceReturnFacetAction.FacetPositionAdjustment.position}
  # is 8.
  #
  # Two cases: a) The facet key "size" is not already in the top 8 slots, then
  # the facet "size" will appear at a position close to 8. b) The facet key
  # "size" in among the top 8 positions in the request, then it will stay at
  # its current rank.
  # @!attribute [rw] facet_position_adjustments
  #   @return [::Array<::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment>]
  #     Each instance corresponds to a force return attribute for the given
  #     condition. There can't be more 15 instances here.
  class ForceReturnFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Each facet position adjustment consists of a single attribute name (i.e.
    # facet key) along with a specified position.
    # @!attribute [rw] attribute_name
    #   @return [::String]
    #     The attribute name to force return as a facet. Each attribute name
    #     should be a valid attribute name, be non-empty and contain at most 80
    #     characters long.
    # @!attribute [rw] position
    #   @return [::Integer]
    #     This is the position in the request as explained above. It should be
    #     strictly positive be at most 100.
    class FacetPositionAdjustment
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Removes an attribute/facet in the request if is present.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: attribute name
  #
  # * Action Result: Will remove the attribute (as a facet) from the request
  # if it is present.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes" and the attribute name "size", then facet key "size" will be
  # removed from the request (if it is present).
  # @!attribute [rw] attribute_names
  #   @return [::Array<::String>]
  #     The attribute names (i.e. facet keys) to remove from the dynamic facets
  #     (if present in the request). There can't be more 3 attribute names.
  #     Each attribute name should be a valid attribute name, be non-empty and
  #     contain at most 80 characters.
  class RemoveFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Pins one or more specified products to a specific position in the
  # results.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
  # uses 1-based indexing).
  #
  # * Action Result: Will pin products with matching ids to the position
  # specified in the final result order.
  #
  # Example: Suppose the query is `shoes`, the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
  # pinned to the top position in the final results.
  #
  # If multiple PinActions are matched to a single request the actions will
  # be processed from most to least recently updated.
  #
  # Pins to positions larger than the max allowed page size of 120 are not
  # allowed.
  # @!attribute [rw] pin_map
  #   @return [::Google::Protobuf::Map{::Integer => ::String}]
  #     Required. A map of positions to product_ids.
  #
  #     Partial matches per action are allowed, if a certain position in the map
  #     is already filled that `[position, product_id]` pair will be ignored
  #     but the rest may still be applied. This case will only occur if multiple
  #     pin actions are matched to a single request, as the map guarantees that
  #     pin positions are unique within the same action.
  #
  #     Duplicate product_ids are not permitted within a single pin map.
  #
  #     The max size of this map is 120, equivalent to the max [request page
  #     size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
  class PinAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # @!attribute [rw] key
    #   @return [::Integer]
    # @!attribute [rw] value
    #   @return [::String]
    class PinMapEntry
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end

#twoway_synonyms_action::Google::Cloud::Retail::V2::Rule::TwowaySynonymsAction

Returns Treats a set of terms as synonyms of one another.

Note: The following fields are mutually exclusive: twoway_synonyms_action, boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, replacement_action, ignore_action, filter_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.

Returns:

  • (::Google::Cloud::Retail::V2::Rule::TwowaySynonymsAction)

    Treats a set of terms as synonyms of one another.

    Note: The following fields are mutually exclusive: twoway_synonyms_action, boost_action, redirect_action, oneway_synonyms_action, do_not_associate_action, replacement_action, ignore_action, filter_action, force_return_facet_action, remove_facet_action, pin_action. If a field in that set is populated, all other fields in the set will automatically be cleared.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 148

class Rule
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # A boost action to apply to results matching condition specified above.
  # @!attribute [rw] boost
  #   @return [::Float]
  #     Strength of the condition boost, which must be in [-1, 1]. Negative
  #     boost means demotion. Default is 0.0.
  #
  #     Setting to 1.0 gives the item a big promotion. However, it does not
  #     necessarily mean that the boosted item will be the top result at all
  #     times, nor that other items will be excluded. Results could still be
  #     shown even when none of them matches the condition. And results that
  #     are significantly more relevant to the search query can still trump
  #     your heavily favored but irrelevant items.
  #
  #     Setting to -1.0 gives the item a big demotion. However, results that
  #     are deeply relevant might still be shown. The item will have an
  #     upstream battle to get a fairly high ranking, but it is not blocked out
  #     completely.
  #
  #     Setting to 0.0 means no boost applied. The boosting condition is
  #     ignored.
  # @!attribute [rw] products_filter
  #   @return [::String]
  #     The filter can have a max size of 5000 characters.
  #     An expression which specifies which products to apply an action to.
  #     The syntax and supported fields are the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations.
  #
  #     Examples:
  #
  #     * To boost products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class BoostAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # * Rule Condition:
  #     - No
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided is a global match.
  #     - 1 or more
  #     {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #     provided are combined with OR operator.
  #
  # * Action Input: The request query and filter that are applied to the
  # retrieved products, in addition to any filters already provided with the
  # SearchRequest. The AND operator is used to combine the query's existing
  # filters with the filter rule(s). NOTE: May result in 0 results when
  # filters conflict.
  #
  # * Action Result: Filters the returned objects to be ONLY those that passed
  # the filter.
  # @!attribute [rw] filter
  #   @return [::String]
  #     A filter to apply on the matching condition results. Supported features:
  #
  #     * {::Google::Cloud::Retail::V2::Rule::FilterAction#filter filter} must be set.
  #     * Filter syntax is identical to
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. For
  #     more
  #       information, see [Filter](/retail/docs/filter-and-order#filter).
  #     * To filter products with product ID "product_1" or "product_2", and
  #     color
  #       "Red" or "Blue":<br>
  #       *(id: ANY("product_1", "product_2"))<br>*
  #       *AND<br>*
  #       *(colorFamilies: ANY("Red", "Blue"))<br>*
  class FilterAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Redirects a shopper to a specific page.
  #
  # * Rule Condition:
  #   Must specify
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}.
  # * Action Input: Request Query
  # * Action Result: Redirects shopper to provided uri.
  # @!attribute [rw] redirect_uri
  #   @return [::String]
  #     URL must have length equal or less than 2000 characters.
  class RedirectAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Creates a set of terms that will be treated as synonyms of each other.
  # Example: synonyms of "sneakers" and "shoes":
  #
  #  * "sneakers" will use a synonym of "shoes".
  #  * "shoes" will use a synonym of "sneakers".
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Can specify up to 100 synonyms.
  #     Must specify at least 2 synonyms.
  class TwowaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Maps a set of terms to a set of synonyms.
  # Set of synonyms will be treated as synonyms of each query term only.
  # `query_terms` will not be treated as synonyms of each other.
  # Example: "sneakers" will use a synonym of "shoes".
  # "shoes" will not use a synonym of "sneakers".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will treat synonyms as their synonyms.
  #     Not themselves synonyms of the synonyms.
  #     Can specify up to 100 terms.
  # @!attribute [rw] synonyms
  #   @return [::Array<::String>]
  #     Defines a set of synonyms.
  #     Cannot contain duplicates.
  #     Can specify up to 100 synonyms.
  # @!attribute [rw] oneway_terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class OnewaySynonymsAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents `query_term` from being associated with specified terms during
  # search.
  # Example: Don't associate "gShoe" and "cheap".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will not consider do_not_associate_terms for search if in search query.
  #     Can specify up to 100 terms.
  # @!attribute [rw] do_not_associate_terms
  #   @return [::Array<::String>]
  #     Cannot contain duplicates or the query term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] terms
  #   @return [::Array<::String>]
  #     Will be [deprecated = true] post migration;
  class DoNotAssociateAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Replaces a term in the query. Multiple replacement candidates can be
  # specified. All `query_terms` will be replaced with the replacement term.
  # Example: Replace "gShoe" with "google shoe".
  # @!attribute [rw] query_terms
  #   @return [::Array<::String>]
  #     Terms from the search query.
  #     Will be replaced by replacement term.
  #     Can specify up to 100 terms.
  # @!attribute [rw] replacement_term
  #   @return [::String]
  #     Term that will be used for replacement.
  # @!attribute [rw] term
  #   @return [::String]
  #     Will be [deprecated = true] post migration;
  class ReplacementAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Prevents a term in the query from being used in search.
  # Example: Don't search for "shoddy".
  # @!attribute [rw] ignore_terms
  #   @return [::Array<::String>]
  #     Terms to ignore in the search query.
  class IgnoreAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Force returns an attribute/facet in the request around a certain position
  # or above.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Inputs: attribute name, position
  #
  # * Action Result: Will force return a facet key around a certain position
  # or above if the condition is satisfied.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes", the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#attribute_name ForceReturnFacetAction.FacetPositionAdjustment.attribute_name}
  # is "size" and the
  # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#position ForceReturnFacetAction.FacetPositionAdjustment.position}
  # is 8.
  #
  # Two cases: a) The facet key "size" is not already in the top 8 slots, then
  # the facet "size" will appear at a position close to 8. b) The facet key
  # "size" in among the top 8 positions in the request, then it will stay at
  # its current rank.
  # @!attribute [rw] facet_position_adjustments
  #   @return [::Array<::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment>]
  #     Each instance corresponds to a force return attribute for the given
  #     condition. There can't be more 15 instances here.
  class ForceReturnFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Each facet position adjustment consists of a single attribute name (i.e.
    # facet key) along with a specified position.
    # @!attribute [rw] attribute_name
    #   @return [::String]
    #     The attribute name to force return as a facet. Each attribute name
    #     should be a valid attribute name, be non-empty and contain at most 80
    #     characters long.
    # @!attribute [rw] position
    #   @return [::Integer]
    #     This is the position in the request as explained above. It should be
    #     strictly positive be at most 100.
    class FacetPositionAdjustment
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Removes an attribute/facet in the request if is present.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: attribute name
  #
  # * Action Result: Will remove the attribute (as a facet) from the request
  # if it is present.
  #
  # Example: Suppose the query is "shoes", the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # "shoes" and the attribute name "size", then facet key "size" will be
  # removed from the request (if it is present).
  # @!attribute [rw] attribute_names
  #   @return [::Array<::String>]
  #     The attribute names (i.e. facet keys) to remove from the dynamic facets
  #     (if present in the request). There can't be more 3 attribute names.
  #     Each attribute name should be a valid attribute name, be non-empty and
  #     contain at most 80 characters.
  class RemoveFacetAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Pins one or more specified products to a specific position in the
  # results.
  #
  # * Rule Condition:
  #   Must specify non-empty
  #   {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}
  #   (for search only) or
  #   {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories}
  #   (for browse only), but can't specify both.
  #
  # * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
  # uses 1-based indexing).
  #
  # * Action Result: Will pin products with matching ids to the position
  # specified in the final result order.
  #
  # Example: Suppose the query is `shoes`, the
  # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is
  # `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
  # pinned to the top position in the final results.
  #
  # If multiple PinActions are matched to a single request the actions will
  # be processed from most to least recently updated.
  #
  # Pins to positions larger than the max allowed page size of 120 are not
  # allowed.
  # @!attribute [rw] pin_map
  #   @return [::Google::Protobuf::Map{::Integer => ::String}]
  #     Required. A map of positions to product_ids.
  #
  #     Partial matches per action are allowed, if a certain position in the map
  #     is already filled that `[position, product_id]` pair will be ignored
  #     but the rest may still be applied. This case will only occur if multiple
  #     pin actions are matched to a single request, as the map guarantees that
  #     pin positions are unique within the same action.
  #
  #     Duplicate product_ids are not permitted within a single pin map.
  #
  #     The max size of this map is 120, equivalent to the max [request page
  #     size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
  class PinAction
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # @!attribute [rw] key
    #   @return [::Integer]
    # @!attribute [rw] value
    #   @return [::String]
    class PinMapEntry
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end
end