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

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

Request message for SearchService.Search method.

Defined Under Namespace

Modules: SearchMode Classes: BoostSpec, ConversationalSearchSpec, DynamicFacetSpec, FacetSpec, LabelsEntry, PersonalizationSpec, QueryExpansionSpec, SpellCorrectionSpec, TileNavigationSpec, UserAttributesEntry

Instance Attribute Summary collapse

Instance Attribute Details

#boost_spec::Google::Cloud::Retail::V2::SearchRequest::BoostSpec

Returns Boost specification to boost certain products. For more information, see Boost results.

Notice that if both ServingConfig.boost_control_ids and SearchRequest.boost_spec are set, the boost conditions from both places are evaluated. If a search request matches multiple boost conditions, the final boost score is equal to the sum of the boost scores from all matched boost conditions.

Returns:



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#branch::String

Returns The branch resource name, such as projects/*/locations/global/catalogs/default_catalog/branches/0.

Use "default_branch" as the branch ID or leave this field empty, to search products under the default branch.

Returns:

  • (::String)

    The branch resource name, such as projects/*/locations/global/catalogs/default_catalog/branches/0.

    Use "default_branch" as the branch ID or leave this field empty, to search products under the default branch.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#canonical_filter::String

Returns The default filter that is applied when a user performs a search without checking any filters on the search page.

The filter applied to every search request when quality improvement such as query expansion is needed. In the case a query does not have a sufficient amount of results this filter will be used to determine whether or not to enable the query expansion flow. The original filter will still be used for the query expanded search. This field is strongly recommended to achieve high search quality.

For more information about filter syntax, see SearchRequest.filter.

Returns:

  • (::String)

    The default filter that is applied when a user performs a search without checking any filters on the search page.

    The filter applied to every search request when quality improvement such as query expansion is needed. In the case a query does not have a sufficient amount of results this filter will be used to determine whether or not to enable the query expansion flow. The original filter will still be used for the query expanded search. This field is strongly recommended to achieve high search quality.

    For more information about filter syntax, see SearchRequest.filter.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#conversational_search_spec::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec

Returns Optional. This field specifies all conversational related parameters addition to traditional retail search.

Returns:



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#dynamic_facet_spec::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec

Deprecated.

This field is deprecated and may be removed in the next major version update.

Returns Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic to enable dynamic facets. Do not set this field.

The specification for dynamically generated facets. Notice that only textual facets can be dynamically generated.

Returns:



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#entity::String

Returns The entity for customers that may run multiple different entities, domains, sites or regions, for example, Google US, Google Ads, Waymo, google.com, youtube.com, etc. If this is set, it should be exactly matched with UserEvent.entity to get search results boosted by entity.

Returns:

  • (::String)

    The entity for customers that may run multiple different entities, domains, sites or regions, for example, Google US, Google Ads, Waymo, google.com, youtube.com, etc. If this is set, it should be exactly matched with UserEvent.entity to get search results boosted by entity.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#facet_specs::Array<::Google::Cloud::Retail::V2::SearchRequest::FacetSpec>

Returns Facet specifications for faceted search. If empty, no facets are returned.

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

Returns:



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#filter::String

Returns The filter syntax consists of an expression language for constructing a predicate from one or more fields of the products being filtered. Filter expression is case-sensitive. For more information, see Filter.

If this field is unrecognizable, an INVALID_ARGUMENT is returned.

Returns:

  • (::String)

    The filter syntax consists of an expression language for constructing a predicate from one or more fields of the products being filtered. Filter expression is case-sensitive. For more information, see Filter.

    If this field is unrecognizable, an INVALID_ARGUMENT is returned.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#labels::Google::Protobuf::Map{::String => ::String}

Returns The labels applied to a resource must meet the following requirements:

  • Each resource can have multiple labels, up to a maximum of 64.
  • Each label must be a key-value pair.
  • Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
  • Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
  • The key portion of a label must be unique. However, you can use the same key with multiple resources.
  • Keys must start with a lowercase letter or international character.

For more information, see Requirements for labels in the Resource Manager documentation.

Returns:

  • (::Google::Protobuf::Map{::String => ::String})

    The labels applied to a resource must meet the following requirements:

    • Each resource can have multiple labels, up to a maximum of 64.
    • Each label must be a key-value pair.
    • Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
    • Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
    • The key portion of a label must be unique. However, you can use the same key with multiple resources.
    • Keys must start with a lowercase letter or international character.

    For more information, see Requirements for labels in the Resource Manager documentation.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#language_code::String

Returns Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" list. For more information, see Standardized codes. This field helps to better interpret the query. If a value isn't specified, the query language code is automatically detected, which may not be accurate.

Returns:

  • (::String)

    Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" list. For more information, see Standardized codes. This field helps to better interpret the query. If a value isn't specified, the query language code is automatically detected, which may not be accurate.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#offset::Integer

Returns A 0-indexed integer that specifies the current offset (that is, starting result location, amongst the Products deemed by the API as relevant) in search results. This field is only considered if page_token is unset.

If this field is negative, an INVALID_ARGUMENT is returned.

Returns:

  • (::Integer)

    A 0-indexed integer that specifies the current offset (that is, starting result location, amongst the Products deemed by the API as relevant) in search results. This field is only considered if page_token is unset.

    If this field is negative, an INVALID_ARGUMENT is returned.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#order_by::String

Returns The order in which products are returned. Products can be ordered by a field in an Product object. Leave it unset if ordered by relevance. OrderBy expression is case-sensitive. For more information, see Order.

If this field is unrecognizable, an INVALID_ARGUMENT is returned.

Returns:

  • (::String)

    The order in which products are returned. Products can be ordered by a field in an Product object. Leave it unset if ordered by relevance. OrderBy expression is case-sensitive. For more information, see Order.

    If this field is unrecognizable, an INVALID_ARGUMENT is returned.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#page_categories::Array<::String>

Returns The categories associated with a category page. Must be set for category navigation queries to achieve good search quality. The format should be the same as UserEvent.page_categories;

To represent full path of category, use '>' sign to separate different hierarchies. If '>' is part of the category name, replace it with other character(s).

Category pages include special pages such as sales or promotions. For instance, a special sale page may have the category hierarchy: "pageCategories" : ["Sales > 2017 Black Friday Deals"].

Returns:

  • (::Array<::String>)

    The categories associated with a category page. Must be set for category navigation queries to achieve good search quality. The format should be the same as UserEvent.page_categories;

    To represent full path of category, use '>' sign to separate different hierarchies. If '>' is part of the category name, replace it with other character(s).

    Category pages include special pages such as sales or promotions. For instance, a special sale page may have the category hierarchy: "pageCategories" : ["Sales > 2017 Black Friday Deals"].



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#page_size::Integer

Returns Maximum number of Products to return. If unspecified, defaults to a reasonable value. The maximum allowed value is

  1. Values above 120 will be coerced to 120.

If this field is negative, an INVALID_ARGUMENT is returned.

Returns:

  • (::Integer)

    Maximum number of Products to return. If unspecified, defaults to a reasonable value. The maximum allowed value is

    1. Values above 120 will be coerced to 120.

    If this field is negative, an INVALID_ARGUMENT is returned.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#page_token::String

Returns A page token SearchResponse.next_page_token, received from a previous SearchService.Search call. Provide this to retrieve the subsequent page.

When paginating, all other parameters provided to SearchService.Search must match the call that provided the page token. Otherwise, an INVALID_ARGUMENT error is returned.

Returns:



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#personalization_spec::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec

Returns The specification for personalization.

Notice that if both ServingConfig.personalization_spec and SearchRequest.personalization_spec are set. SearchRequest.personalization_spec will override ServingConfig.personalization_spec.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#place_id::String

Returns Optional. An id corresponding to a place, such as a store id or region id. When specified, we use the price from the local inventory with the matching product's LocalInventory.place_id for revenue optimization.

Returns:

  • (::String)

    Optional. An id corresponding to a place, such as a store id or region id. When specified, we use the price from the local inventory with the matching product's LocalInventory.place_id for revenue optimization.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#placement::String

Returns Required. The resource name of the Retail Search serving config, such as projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config or the name of the legacy placement resource, such as projects/*/locations/global/catalogs/default_catalog/placements/default_search. This field is used to identify the serving config name and the set of models that are used to make the search.

Returns:

  • (::String)

    Required. The resource name of the Retail Search serving config, such as projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config or the name of the legacy placement resource, such as projects/*/locations/global/catalogs/default_catalog/placements/default_search. This field is used to identify the serving config name and the set of models that are used to make the search.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#query::String

Returns Raw search query.

If this field is empty, the request is considered a category browsing request and returned results are based on filter and page_categories.

Returns:

  • (::String)

    Raw search query.

    If this field is empty, the request is considered a category browsing request and returned results are based on filter and page_categories.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#query_expansion_spec::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec

Returns The query expansion specification that specifies the conditions under which query expansion occurs. For more information, see Query expansion.

Returns:



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#region_code::String

Returns Optional. The Unicode country/region code (CLDR) of a location, such as "US" and "419" list. For more information, see Standardized codes. If set, then results will be boosted based on the region_code provided.

Returns:

  • (::String)

    Optional. The Unicode country/region code (CLDR) of a location, such as "US" and "419" list. For more information, see Standardized codes. If set, then results will be boosted based on the region_code provided.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#search_mode::Google::Cloud::Retail::V2::SearchRequest::SearchMode

Returns The search mode of the search request. If not specified, a single search request triggers both product search and faceted search.

Returns:



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#spell_correction_spec::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec

Returns The spell correction specification that specifies the mode under which spell correction will take effect.

Returns:



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#tile_navigation_spec::Google::Cloud::Retail::V2::SearchRequest::TileNavigationSpec

Returns Optional. This field specifies tile navigation related parameters.

Returns:



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#user_attributes::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::StringList}

Returns Optional. The user attributes that could be used for personalization of search results.

  • Populate at most 100 key-value pairs per query.
  • Only supports string keys and repeated string values.
  • Duplcate keys are not allowed within a single query.

Example: user_attributes: [ { key: "pets" value { values: "dog" values: "cat" } }, { key: "state" value { values: "CA" } } ].

Returns:

  • (::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::StringList})

    Optional. The user attributes that could be used for personalization of search results.

    • Populate at most 100 key-value pairs per query.
    • Only supports string keys and repeated string values.
    • Duplcate keys are not allowed within a single query.

    Example: user_attributes: [ { key: "pets" value { values: "dog" values: "cat" } }, { key: "state" value { values: "CA" } } ]



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#user_info::Google::Cloud::Retail::V2::UserInfo

Returns User information.

Returns:



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#variant_rollup_keys::Array<::String>

Returns The keys to fetch and rollup the matching variant Products attributes, FulfillmentInfo or LocalInventorys attributes. The attributes from all the matching variant Products or LocalInventorys are merged and de-duplicated. Notice that rollup attributes will lead to extra query latency. Maximum number of keys is 30.

For FulfillmentInfo, a fulfillment type and a fulfillment ID must be provided in the format of "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", "pickupInStore" is fulfillment type and "store123" is the store ID.

Supported keys are:

If this field is set to an invalid value other than these, an INVALID_ARGUMENT error is returned.

Returns:



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end

#visitor_id::String

Returns Required. A unique identifier for tracking visitors. For example, this could be implemented with an HTTP cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor logs in or out of the website.

This should be the same identifier as UserEvent.visitor_id.

The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Returns:

  • (::String)

    Required. A unique identifier for tracking visitors. For example, this could be implemented with an HTTP cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor logs in or out of the website.

    This should be the same identifier as UserEvent.visitor_id.

    The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'proto_docs/google/cloud/retail/v2/search_service.rb', line 384

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

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey]
  #     Required. The facet key specification.
  # @!attribute [rw] limit
  #   @return [::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.
  # @!attribute [rw] excluded_filter_keys
  #   @return [::Array<::String>]
  #     List of keys to exclude when faceting.
  #
  #     By default,
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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
  #     {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key 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.
  # @!attribute [rw] enable_dynamic_position
  #   @return [::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.
  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

  # The specifications of dynamically generated facets.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode]
  #     Mode of the DynamicFacet feature.
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED}
  #     if it's unset.
  class DynamicFacetSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum to control DynamicFacet mode
    module Mode
      # Default value.
      MODE_UNSPECIFIED = 0

      # Disable Dynamic Facet.
      DISABLED = 1

      # Automatic mode built by Google Retail Search.
      ENABLED = 2
    end
  end

  # Boost specification to boost certain items.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a product matches multiple conditions
  #     in the specifications, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  # @!attribute [rw] skip_boost_spec_validation
  #   @return [::Boolean]
  #     Whether to skip boostspec validation. If this field is set to true,
  #     invalid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will be ignored and valid
  #     {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs}
  #     will still be applied.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to products which match a condition.
    # @!attribute [rw] condition
    #   @return [::String]
    #     An expression which specifies a boost condition. 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":
    #         * (id: ANY("product_1", "product_2")) AND (colorFamilies:
    #         ANY("Red","Blue"))
    # @!attribute [rw] boost
    #   @return [::Float]
    #     Strength of the condition boost, which should 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.
    class ConditionBoostSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Specification to determine under which conditions query expansion should
  # occur.
  # @!attribute [rw] condition
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. The default value is false. If this
  #     field is set to true,
  #     unexpanded products are always at the top of the search results, followed
  #     by the expanded results.
  class QueryExpansionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which condition query expansion should occur.
    module Condition
      # Unspecified query expansion condition. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

      # Disabled query expansion. Only the exact search query is used, even if
      # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size}
      # is zero.
      DISABLED = 1

      # Automatic query expansion built by Google Retail Search.
      AUTO = 3
    end
  end

  # The specification for personalization.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode]
  #     Defaults to
  #     {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
  class PersonalizationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # The personalization mode of each search request.
    module Mode
      # Default value. In this case, server behavior defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Let CRS decide whether to use personalization based on quality of user
      # event data.
      AUTO = 1

      # Disable personalization.
      DISABLED = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
  class SpellCorrectionSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Enum describing under which mode spell correction should occur.
    module Mode
      # Unspecified spell correction mode. In this case, server behavior
      # defaults to
      # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Google Retail Search will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}.
      # The spell suggestion will not be used as the search query.
      SUGGESTION_ONLY = 1

      # Automatic spell correction built by Google Retail Search. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # This field specifies all conversational related parameters addition to
  # traditional retail search.
  # @!attribute [rw] followup_conversation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to do conversational
  #     search. If this field is set to true, conversational related extra
  #     information will be returned from server side, including follow-up
  #     question, answer options, etc.
  # @!attribute [rw] conversation_id
  #   @return [::String]
  #     This field specifies the conversation id, which maintains the state of
  #     the conversation between client side and server side. Use the value from
  #     the previous [ConversationalSearchResult.conversation_id][]. For the
  #     initial request, this should be empty.
  # @!attribute [rw] user_answer
  #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer]
  #     This field specifies the current user answer during the conversational
  #     search. This can be either user selected from suggested answers or user
  #     input plain text.
  class ConversationalSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # This field specifies the current user answer during the conversational
    # search. This can be either user selected from suggested answers or user
    # input plain text.
    # @!attribute [rw] text_answer
    #   @return [::String]
    #     This field specifies the incremental input text from the user during
    #     the conversational search.
    #
    #     Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    # @!attribute [rw] selected_answer
    #   @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer]
    #     This field specifies the selected attributes during the
    #     conversational search. This should be a subset of
    #     [ConversationalSearchResult.suggested_answers][].
    #
    #     Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared.
    class UserAnswer
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # This field specifies the selected answers during the conversational
      # search.
      # @!attribute [rw] product_attribute_values
      #   @deprecated This field is deprecated and may be removed in the next major version update.
      #   @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>]
      #     This field is deprecated and should not be set.
      # @!attribute [rw] product_attribute_value
      #   @return [::Google::Cloud::Retail::V2::ProductAttributeValue]
      #     This field specifies the selected answer which is a attribute
      #     key-value.
      class SelectedAnswer
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end
  end

  # This field specifies tile navigation related parameters.
  # @!attribute [rw] tile_navigation_requested
  #   @return [::Boolean]
  #     This field specifies whether the customer would like to request tile
  #     navigation.
  # @!attribute [rw] applied_tiles
  #   @return [::Array<::Google::Cloud::Retail::V2::Tile>]
  #     This optional field specifies the tiles which are already clicked in
  #     client side. While the feature works without this field set, particularly
  #     for an initial query, it is highly recommended to set this field because
  #     it can improve the quality of the search response and removes possible
  #     duplicate tiles.
  #
  #     NOTE: This field is not being used for filtering search
  #     products. Client side should also put all the applied tiles in
  #     {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}.
  class TileNavigationSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::Google::Cloud::Retail::V2::StringList]
  class UserAttributesEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The search mode of each search request.
  module SearchMode
    # Default value. In this case both product search and faceted search will
    # be performed. Both
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet}
    # will be returned.
    SEARCH_MODE_UNSPECIFIED = 0

    # Only product search will be performed. The faceted search will be
    # disabled.
    #
    # Only
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # not be returned, even if
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # or
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # is set.
    PRODUCT_SEARCH_ONLY = 1

    # Only faceted search will be performed. The product search will be
    # disabled.
    #
    # When in this mode, one or both of
    # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs}
    # and
    # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec}
    # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
    # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will
    # be returned.
    # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult}
    # will not be returned.
    FACETED_SEARCH_ONLY = 2
  end
end