Class: Google::Cloud::Retail::V2::SearchRequest::FacetSpec

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

Overview

A facet specification to perform faceted search.

Defined Under Namespace

Classes: FacetKey

Instance Attribute Summary collapse

Instance Attribute Details

#enable_dynamic_position::Boolean

Returns Enables dynamic position for this facet. If set to true, the position of this facet among all facets in the response is determined by Google Retail Search. It is ordered together with dynamic facets if dynamic facets is enabled. If set to false, the position of this facet in the response is the same as in the request, and it is ranked before the facets with dynamic position enable and all dynamic facets.

For example, you may always want to have rating facet returned in the response, but it's not necessarily to always display the rating facet at the top. In that case, you can set enable_dynamic_position to true so that the position of rating facet in response is determined by Google Retail Search.

Another example, assuming you have the following facets in the request:

  • "rating", enable_dynamic_position = true

  • "price", enable_dynamic_position = false

  • "brands", enable_dynamic_position = false

And also you have a dynamic facets enable, which generates a facet "gender". Then, the final order of the facets in the response can be ("price", "brands", "rating", "gender") or ("price", "brands", "gender", "rating") depends on how Google Retail Search orders "gender" and "rating" facets. However, notice that "price" and "brands" are always ranked at first and second position because their enable_dynamic_position values are false.

Returns:

  • (::Boolean)

    Enables dynamic position for this facet. If set to true, the position of this facet among all facets in the response is determined by Google Retail Search. It is ordered together with dynamic facets if dynamic facets is enabled. If set to false, the position of this facet in the response is the same as in the request, and it is ranked before the facets with dynamic position enable and all dynamic facets.

    For example, you may always want to have rating facet returned in the response, but it's not necessarily to always display the rating facet at the top. In that case, you can set enable_dynamic_position to true so that the position of rating facet in response is determined by Google Retail Search.

    Another example, assuming you have the following facets in the request:

    • "rating", enable_dynamic_position = true

    • "price", enable_dynamic_position = false

    • "brands", enable_dynamic_position = false

    And also you have a dynamic facets enable, which generates a facet "gender". Then, the final order of the facets in the response can be ("price", "brands", "rating", "gender") or ("price", "brands", "gender", "rating") depends on how Google Retail Search orders "gender" and "rating" facets. However, notice that "price" and "brands" are always ranked at first and second position because their enable_dynamic_position values are false.



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 412

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

  # Specifies how a facet is computed.
  # @!attribute [rw] key
  #   @return [::String]
  #     Required. Supported textual and numerical facet keys in
  #     {::Google::Cloud::Retail::V2::Product Product} object, over which the facet
  #     values are computed. Facet key is case-sensitive.
  #
  #     Allowed facet keys when
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query FacetKey.query}
  #     is not specified:
  #
  #     * textual_field =
  #         * "brands"
  #         * "categories"
  #         * "genders"
  #         * "ageGroups"
  #         * "availability"
  #         * "colorFamilies"
  #         * "colors"
  #         * "sizes"
  #         * "materials"
  #         * "patterns"
  #         * "conditions"
  #         * "attributes.key"
  #         * "pickupInStore"
  #         * "shipToStore"
  #         * "sameDayDelivery"
  #         * "nextDayDelivery"
  #         * "customFulfillment1"
  #         * "customFulfillment2"
  #         * "customFulfillment3"
  #         * "customFulfillment4"
  #         * "customFulfillment5"
  #         * "inventory(place_id,attributes.key)"
  #
  #     * numerical_field =
  #         * "price"
  #         * "discount"
  #         * "rating"
  #         * "ratingCount"
  #         * "attributes.key"
  #         * "inventory(place_id,price)"
  #         * "inventory(place_id,original_price)"
  #         * "inventory(place_id,attributes.key)"
  # @!attribute [rw] intervals
  #   @return [::Array<::Google::Cloud::Retail::V2::Interval>]
  #     Set only if values should be bucketized into intervals. Must be set
  #     for facets with numerical values. Must not be set for facet with text
  #     values. Maximum number of intervals is 40.
  #
  #     For all numerical facet keys that appear in the list of products from
  #     the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are
  #     computed from their distribution weekly. If the model assigns a high
  #     score to a numerical facet key and its intervals are not specified in
  #     the search request, these percentiles become the bounds
  #     for its intervals and are returned in the response. If the
  #     facet key intervals are specified in the request, then the specified
  #     intervals are returned instead.
  # @!attribute [rw] restricted_values
  #   @return [::Array<::String>]
  #     Only get facet for the given restricted values. For example, when using
  #     "pickupInStore" as key and set restricted values to
  #     ["store123", "store456"], only facets for "store123" and "store456" are
  #     returned. Only supported on predefined textual fields, custom textual
  #     attributes and fulfillments. Maximum is 20.
  #
  #     Must be set for the fulfillment facet keys:
  #
  #     * pickupInStore
  #
  #     * shipToStore
  #
  #     * sameDayDelivery
  #
  #     * nextDayDelivery
  #
  #     * customFulfillment1
  #
  #     * customFulfillment2
  #
  #     * customFulfillment3
  #
  #     * customFulfillment4
  #
  #     * customFulfillment5
  # @!attribute [rw] prefixes
  #   @return [::Array<::String>]
  #     Only get facet values that start with the given string prefix. For
  #     example, suppose "categories" has three values "Women > Shoe",
  #     "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the
  #     "categories" facet gives only "Women > Shoe" and "Women > Dress".
  #     Only supported on textual fields. Maximum is 10.
  # @!attribute [rw] contains
  #   @return [::Array<::String>]
  #     Only get facet values that contains the given strings. For example,
  #     suppose "categories" has three values "Women > Shoe",
  #     "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the
  #     "categories" facet gives only "Women > Shoe" and "Men > Shoe".
  #     Only supported on textual fields. Maximum is 10.
  # @!attribute [rw] case_insensitive
  #   @return [::Boolean]
  #     True to make facet keys case insensitive when getting faceting
  #     values with prefixes or contains; false otherwise.
  # @!attribute [rw] order_by
  #   @return [::String]
  #     The order in which
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet#values SearchResponse.Facet.values}
  #     are returned.
  #
  #     Allowed values are:
  #
  #     * "count desc", which means order by
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
  #     descending.
  #
  #     * "value desc", which means order by
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value SearchResponse.Facet.values.value}
  #     descending.
  #       Only applies to textual facets.
  #
  #     If not set, textual values are sorted in [natural
  #     order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
  #     intervals are sorted in the order given by
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals};
  #     {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids}
  #     are sorted in the order given by
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#restricted_values FacetSpec.FacetKey.restricted_values}.
  # @!attribute [rw] query
  #   @return [::String]
  #     The query that is used to compute facet for the given facet key.
  #     When provided, it overrides the default behavior of facet
  #     computation. The query syntax is the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations. Notice that there is no limitation on
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     when query is specified.
  #
  #     In the response,
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value SearchResponse.Facet.values.value}
  #     is always "1" and
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
  #     is the number of results that match the query.
  #
  #     For example, you can set a customized facet for "shipToStore",
  #     where
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     is "customizedShipToStore", and
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query FacetKey.query}
  #     is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")".
  #     Then the facet counts the products that are both in stock and ship
  #     to store "123".
  # @!attribute [rw] return_min_max
  #   @return [::Boolean]
  #     Returns the min and max value for each numerical facet intervals.
  #     Ignored for textual facets.
  class FacetKey
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#excluded_filter_keys::Array<::String>

List of keys to exclude when faceting.

By default, FacetKey.key is not excluded from the filter unless it is listed in this field.

Listing a facet key in this field allows its values to appear as facet results, even when they are filtered out of search results. Using this field does not affect what search results are returned.

For example, suppose there are 100 products with the color facet "Red" and 200 products with the color facet "Blue". A query containing the filter "colorFamilies:ANY("Red")" and having "colorFamilies" as FacetKey.key would by default return only "Red" products in the search results, and also return "Red" with count 100 as the only color facet. Although there are also blue products available, "Blue" would not be shown as an available facet value.

If "colorFamilies" is listed in "excludedFilterKeys", then the query returns the facet values "Red" with count 100 and "Blue" with count 200, because the "colorFamilies" key is now excluded from the filter. Because this field doesn't affect search results, the search results are still correctly filtered to return only "Red" products.

A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error is returned.

Returns:

  • (::Array<::String>)

    List of keys to exclude when faceting.

    By default, FacetKey.key is not excluded from the filter unless it is listed in this field.

    Listing a facet key in this field allows its values to appear as facet results, even when they are filtered out of search results. Using this field does not affect what search results are returned.

    For example, suppose there are 100 products with the color facet "Red" and 200 products with the color facet "Blue". A query containing the filter "colorFamilies:ANY("Red")" and having "colorFamilies" as FacetKey.key would by default return only "Red" products in the search results, and also return "Red" with count 100 as the only color facet. Although there are also blue products available, "Blue" would not be shown as an available facet value.

    If "colorFamilies" is listed in "excludedFilterKeys", then the query returns the facet values "Red" with count 100 and "Blue" with count 200, because the "colorFamilies" key is now excluded from the filter. Because this field doesn't affect search results, the search results are still correctly filtered to return only "Red" products.

    A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error is returned.



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 412

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

  # Specifies how a facet is computed.
  # @!attribute [rw] key
  #   @return [::String]
  #     Required. Supported textual and numerical facet keys in
  #     {::Google::Cloud::Retail::V2::Product Product} object, over which the facet
  #     values are computed. Facet key is case-sensitive.
  #
  #     Allowed facet keys when
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query FacetKey.query}
  #     is not specified:
  #
  #     * textual_field =
  #         * "brands"
  #         * "categories"
  #         * "genders"
  #         * "ageGroups"
  #         * "availability"
  #         * "colorFamilies"
  #         * "colors"
  #         * "sizes"
  #         * "materials"
  #         * "patterns"
  #         * "conditions"
  #         * "attributes.key"
  #         * "pickupInStore"
  #         * "shipToStore"
  #         * "sameDayDelivery"
  #         * "nextDayDelivery"
  #         * "customFulfillment1"
  #         * "customFulfillment2"
  #         * "customFulfillment3"
  #         * "customFulfillment4"
  #         * "customFulfillment5"
  #         * "inventory(place_id,attributes.key)"
  #
  #     * numerical_field =
  #         * "price"
  #         * "discount"
  #         * "rating"
  #         * "ratingCount"
  #         * "attributes.key"
  #         * "inventory(place_id,price)"
  #         * "inventory(place_id,original_price)"
  #         * "inventory(place_id,attributes.key)"
  # @!attribute [rw] intervals
  #   @return [::Array<::Google::Cloud::Retail::V2::Interval>]
  #     Set only if values should be bucketized into intervals. Must be set
  #     for facets with numerical values. Must not be set for facet with text
  #     values. Maximum number of intervals is 40.
  #
  #     For all numerical facet keys that appear in the list of products from
  #     the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are
  #     computed from their distribution weekly. If the model assigns a high
  #     score to a numerical facet key and its intervals are not specified in
  #     the search request, these percentiles become the bounds
  #     for its intervals and are returned in the response. If the
  #     facet key intervals are specified in the request, then the specified
  #     intervals are returned instead.
  # @!attribute [rw] restricted_values
  #   @return [::Array<::String>]
  #     Only get facet for the given restricted values. For example, when using
  #     "pickupInStore" as key and set restricted values to
  #     ["store123", "store456"], only facets for "store123" and "store456" are
  #     returned. Only supported on predefined textual fields, custom textual
  #     attributes and fulfillments. Maximum is 20.
  #
  #     Must be set for the fulfillment facet keys:
  #
  #     * pickupInStore
  #
  #     * shipToStore
  #
  #     * sameDayDelivery
  #
  #     * nextDayDelivery
  #
  #     * customFulfillment1
  #
  #     * customFulfillment2
  #
  #     * customFulfillment3
  #
  #     * customFulfillment4
  #
  #     * customFulfillment5
  # @!attribute [rw] prefixes
  #   @return [::Array<::String>]
  #     Only get facet values that start with the given string prefix. For
  #     example, suppose "categories" has three values "Women > Shoe",
  #     "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the
  #     "categories" facet gives only "Women > Shoe" and "Women > Dress".
  #     Only supported on textual fields. Maximum is 10.
  # @!attribute [rw] contains
  #   @return [::Array<::String>]
  #     Only get facet values that contains the given strings. For example,
  #     suppose "categories" has three values "Women > Shoe",
  #     "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the
  #     "categories" facet gives only "Women > Shoe" and "Men > Shoe".
  #     Only supported on textual fields. Maximum is 10.
  # @!attribute [rw] case_insensitive
  #   @return [::Boolean]
  #     True to make facet keys case insensitive when getting faceting
  #     values with prefixes or contains; false otherwise.
  # @!attribute [rw] order_by
  #   @return [::String]
  #     The order in which
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet#values SearchResponse.Facet.values}
  #     are returned.
  #
  #     Allowed values are:
  #
  #     * "count desc", which means order by
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
  #     descending.
  #
  #     * "value desc", which means order by
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value SearchResponse.Facet.values.value}
  #     descending.
  #       Only applies to textual facets.
  #
  #     If not set, textual values are sorted in [natural
  #     order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
  #     intervals are sorted in the order given by
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals};
  #     {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids}
  #     are sorted in the order given by
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#restricted_values FacetSpec.FacetKey.restricted_values}.
  # @!attribute [rw] query
  #   @return [::String]
  #     The query that is used to compute facet for the given facet key.
  #     When provided, it overrides the default behavior of facet
  #     computation. The query syntax is the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations. Notice that there is no limitation on
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     when query is specified.
  #
  #     In the response,
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value SearchResponse.Facet.values.value}
  #     is always "1" and
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
  #     is the number of results that match the query.
  #
  #     For example, you can set a customized facet for "shipToStore",
  #     where
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     is "customizedShipToStore", and
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query FacetKey.query}
  #     is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")".
  #     Then the facet counts the products that are both in stock and ship
  #     to store "123".
  # @!attribute [rw] return_min_max
  #   @return [::Boolean]
  #     Returns the min and max value for each numerical facet intervals.
  #     Ignored for textual facets.
  class FacetKey
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#facet_key::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey

Returns Required. The facet key specification.

Returns:



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 412

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

  # Specifies how a facet is computed.
  # @!attribute [rw] key
  #   @return [::String]
  #     Required. Supported textual and numerical facet keys in
  #     {::Google::Cloud::Retail::V2::Product Product} object, over which the facet
  #     values are computed. Facet key is case-sensitive.
  #
  #     Allowed facet keys when
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query FacetKey.query}
  #     is not specified:
  #
  #     * textual_field =
  #         * "brands"
  #         * "categories"
  #         * "genders"
  #         * "ageGroups"
  #         * "availability"
  #         * "colorFamilies"
  #         * "colors"
  #         * "sizes"
  #         * "materials"
  #         * "patterns"
  #         * "conditions"
  #         * "attributes.key"
  #         * "pickupInStore"
  #         * "shipToStore"
  #         * "sameDayDelivery"
  #         * "nextDayDelivery"
  #         * "customFulfillment1"
  #         * "customFulfillment2"
  #         * "customFulfillment3"
  #         * "customFulfillment4"
  #         * "customFulfillment5"
  #         * "inventory(place_id,attributes.key)"
  #
  #     * numerical_field =
  #         * "price"
  #         * "discount"
  #         * "rating"
  #         * "ratingCount"
  #         * "attributes.key"
  #         * "inventory(place_id,price)"
  #         * "inventory(place_id,original_price)"
  #         * "inventory(place_id,attributes.key)"
  # @!attribute [rw] intervals
  #   @return [::Array<::Google::Cloud::Retail::V2::Interval>]
  #     Set only if values should be bucketized into intervals. Must be set
  #     for facets with numerical values. Must not be set for facet with text
  #     values. Maximum number of intervals is 40.
  #
  #     For all numerical facet keys that appear in the list of products from
  #     the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are
  #     computed from their distribution weekly. If the model assigns a high
  #     score to a numerical facet key and its intervals are not specified in
  #     the search request, these percentiles become the bounds
  #     for its intervals and are returned in the response. If the
  #     facet key intervals are specified in the request, then the specified
  #     intervals are returned instead.
  # @!attribute [rw] restricted_values
  #   @return [::Array<::String>]
  #     Only get facet for the given restricted values. For example, when using
  #     "pickupInStore" as key and set restricted values to
  #     ["store123", "store456"], only facets for "store123" and "store456" are
  #     returned. Only supported on predefined textual fields, custom textual
  #     attributes and fulfillments. Maximum is 20.
  #
  #     Must be set for the fulfillment facet keys:
  #
  #     * pickupInStore
  #
  #     * shipToStore
  #
  #     * sameDayDelivery
  #
  #     * nextDayDelivery
  #
  #     * customFulfillment1
  #
  #     * customFulfillment2
  #
  #     * customFulfillment3
  #
  #     * customFulfillment4
  #
  #     * customFulfillment5
  # @!attribute [rw] prefixes
  #   @return [::Array<::String>]
  #     Only get facet values that start with the given string prefix. For
  #     example, suppose "categories" has three values "Women > Shoe",
  #     "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the
  #     "categories" facet gives only "Women > Shoe" and "Women > Dress".
  #     Only supported on textual fields. Maximum is 10.
  # @!attribute [rw] contains
  #   @return [::Array<::String>]
  #     Only get facet values that contains the given strings. For example,
  #     suppose "categories" has three values "Women > Shoe",
  #     "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the
  #     "categories" facet gives only "Women > Shoe" and "Men > Shoe".
  #     Only supported on textual fields. Maximum is 10.
  # @!attribute [rw] case_insensitive
  #   @return [::Boolean]
  #     True to make facet keys case insensitive when getting faceting
  #     values with prefixes or contains; false otherwise.
  # @!attribute [rw] order_by
  #   @return [::String]
  #     The order in which
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet#values SearchResponse.Facet.values}
  #     are returned.
  #
  #     Allowed values are:
  #
  #     * "count desc", which means order by
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
  #     descending.
  #
  #     * "value desc", which means order by
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value SearchResponse.Facet.values.value}
  #     descending.
  #       Only applies to textual facets.
  #
  #     If not set, textual values are sorted in [natural
  #     order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
  #     intervals are sorted in the order given by
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals};
  #     {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids}
  #     are sorted in the order given by
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#restricted_values FacetSpec.FacetKey.restricted_values}.
  # @!attribute [rw] query
  #   @return [::String]
  #     The query that is used to compute facet for the given facet key.
  #     When provided, it overrides the default behavior of facet
  #     computation. The query syntax is the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations. Notice that there is no limitation on
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     when query is specified.
  #
  #     In the response,
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value SearchResponse.Facet.values.value}
  #     is always "1" and
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
  #     is the number of results that match the query.
  #
  #     For example, you can set a customized facet for "shipToStore",
  #     where
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     is "customizedShipToStore", and
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query FacetKey.query}
  #     is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")".
  #     Then the facet counts the products that are both in stock and ship
  #     to store "123".
  # @!attribute [rw] return_min_max
  #   @return [::Boolean]
  #     Returns the min and max value for each numerical facet intervals.
  #     Ignored for textual facets.
  class FacetKey
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end

#limit::Integer

Returns Maximum of facet values that should be returned for this facet. If unspecified, defaults to 50. The maximum allowed value is 300. Values above 300 will be coerced to 300.

If this field is negative, an INVALID_ARGUMENT is returned.

Returns:

  • (::Integer)

    Maximum of facet values that should be returned for this facet. If unspecified, defaults to 50. The maximum allowed value is 300. Values above 300 will be coerced to 300.

    If this field is negative, an INVALID_ARGUMENT is returned.



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 412

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

  # Specifies how a facet is computed.
  # @!attribute [rw] key
  #   @return [::String]
  #     Required. Supported textual and numerical facet keys in
  #     {::Google::Cloud::Retail::V2::Product Product} object, over which the facet
  #     values are computed. Facet key is case-sensitive.
  #
  #     Allowed facet keys when
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query FacetKey.query}
  #     is not specified:
  #
  #     * textual_field =
  #         * "brands"
  #         * "categories"
  #         * "genders"
  #         * "ageGroups"
  #         * "availability"
  #         * "colorFamilies"
  #         * "colors"
  #         * "sizes"
  #         * "materials"
  #         * "patterns"
  #         * "conditions"
  #         * "attributes.key"
  #         * "pickupInStore"
  #         * "shipToStore"
  #         * "sameDayDelivery"
  #         * "nextDayDelivery"
  #         * "customFulfillment1"
  #         * "customFulfillment2"
  #         * "customFulfillment3"
  #         * "customFulfillment4"
  #         * "customFulfillment5"
  #         * "inventory(place_id,attributes.key)"
  #
  #     * numerical_field =
  #         * "price"
  #         * "discount"
  #         * "rating"
  #         * "ratingCount"
  #         * "attributes.key"
  #         * "inventory(place_id,price)"
  #         * "inventory(place_id,original_price)"
  #         * "inventory(place_id,attributes.key)"
  # @!attribute [rw] intervals
  #   @return [::Array<::Google::Cloud::Retail::V2::Interval>]
  #     Set only if values should be bucketized into intervals. Must be set
  #     for facets with numerical values. Must not be set for facet with text
  #     values. Maximum number of intervals is 40.
  #
  #     For all numerical facet keys that appear in the list of products from
  #     the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are
  #     computed from their distribution weekly. If the model assigns a high
  #     score to a numerical facet key and its intervals are not specified in
  #     the search request, these percentiles become the bounds
  #     for its intervals and are returned in the response. If the
  #     facet key intervals are specified in the request, then the specified
  #     intervals are returned instead.
  # @!attribute [rw] restricted_values
  #   @return [::Array<::String>]
  #     Only get facet for the given restricted values. For example, when using
  #     "pickupInStore" as key and set restricted values to
  #     ["store123", "store456"], only facets for "store123" and "store456" are
  #     returned. Only supported on predefined textual fields, custom textual
  #     attributes and fulfillments. Maximum is 20.
  #
  #     Must be set for the fulfillment facet keys:
  #
  #     * pickupInStore
  #
  #     * shipToStore
  #
  #     * sameDayDelivery
  #
  #     * nextDayDelivery
  #
  #     * customFulfillment1
  #
  #     * customFulfillment2
  #
  #     * customFulfillment3
  #
  #     * customFulfillment4
  #
  #     * customFulfillment5
  # @!attribute [rw] prefixes
  #   @return [::Array<::String>]
  #     Only get facet values that start with the given string prefix. For
  #     example, suppose "categories" has three values "Women > Shoe",
  #     "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the
  #     "categories" facet gives only "Women > Shoe" and "Women > Dress".
  #     Only supported on textual fields. Maximum is 10.
  # @!attribute [rw] contains
  #   @return [::Array<::String>]
  #     Only get facet values that contains the given strings. For example,
  #     suppose "categories" has three values "Women > Shoe",
  #     "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the
  #     "categories" facet gives only "Women > Shoe" and "Men > Shoe".
  #     Only supported on textual fields. Maximum is 10.
  # @!attribute [rw] case_insensitive
  #   @return [::Boolean]
  #     True to make facet keys case insensitive when getting faceting
  #     values with prefixes or contains; false otherwise.
  # @!attribute [rw] order_by
  #   @return [::String]
  #     The order in which
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet#values SearchResponse.Facet.values}
  #     are returned.
  #
  #     Allowed values are:
  #
  #     * "count desc", which means order by
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
  #     descending.
  #
  #     * "value desc", which means order by
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value SearchResponse.Facet.values.value}
  #     descending.
  #       Only applies to textual facets.
  #
  #     If not set, textual values are sorted in [natural
  #     order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
  #     intervals are sorted in the order given by
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals};
  #     {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids}
  #     are sorted in the order given by
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#restricted_values FacetSpec.FacetKey.restricted_values}.
  # @!attribute [rw] query
  #   @return [::String]
  #     The query that is used to compute facet for the given facet key.
  #     When provided, it overrides the default behavior of facet
  #     computation. The query syntax is the same as a filter expression. See
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for
  #     detail syntax and limitations. Notice that there is no limitation on
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     when query is specified.
  #
  #     In the response,
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value SearchResponse.Facet.values.value}
  #     is always "1" and
  #     {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
  #     is the number of results that match the query.
  #
  #     For example, you can set a customized facet for "shipToStore",
  #     where
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     is "customizedShipToStore", and
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query FacetKey.query}
  #     is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")".
  #     Then the facet counts the products that are both in stock and ship
  #     to store "123".
  # @!attribute [rw] return_min_max
  #   @return [::Boolean]
  #     Returns the min and max value for each numerical facet intervals.
  #     Ignored for textual facets.
  class FacetKey
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end
end