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, RedirectAction, RemoveFacetAction, ReplacementAction, TwowaySynonymsAction

Instance Attribute Summary collapse

Instance Attribute Details

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

Returns A boost action.

Returns:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 122

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
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:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 122

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
end

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

Returns Prevents term from being associated with other terms.

Returns:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 122

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
end

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

Returns Filters results.

Returns:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 122

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
end

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

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

Returns:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 122

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
end

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

Returns Ignores specific terms from query during search.

Returns:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 122

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
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.

Returns:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 122

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
end

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

Returns Redirects a shopper to a specific page.

Returns:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 122

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
end

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

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

Returns:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 122

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
end

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

Returns Replaces specific terms in the query.

Returns:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 122

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
end

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

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

Returns:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
# File 'proto_docs/google/cloud/retail/v2/common.rb', line 122

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
end