Class: Google::Cloud::DiscoveryEngine::V1beta::SearchRequest

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

Overview

Request message for SearchService.Search method.

Defined Under Namespace

Classes: BoostSpec, ContentSearchSpec, DataStoreSpec, EmbeddingSpec, FacetSpec, ImageQuery, ParamsEntry, QueryExpansionSpec, SpellCorrectionSpec, UserLabelsEntry

Instance Attribute Summary collapse

Instance Attribute Details

#boost_spec::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec

Returns Boost specification to boost certain documents. For more information on boosting, see Boosting.

Returns:



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#branch::String

Returns The branch resource name, such as projects/*/locations/global/collections/default_collection/dataStores/default_data_store/branches/0.

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

Returns:

  • (::String)

    The branch resource name, such as projects/*/locations/global/collections/default_collection/dataStores/default_data_store/branches/0.

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



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class UserLabelsEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  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.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#content_search_spec::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec

Returns A specification for configuring the behavior of content search.

Returns:



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#data_store_specs::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::DataStoreSpec>

Returns A list of data store specs to apply on a search call.

Returns:



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#embedding_spec::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec

Returns Uses the provided embedding to do additional semantic document retrieval. The retrieval is based on the dot product of SearchRequest.EmbeddingSpec.EmbeddingVector.vector and the document embedding that is provided in SearchRequest.EmbeddingSpec.EmbeddingVector.field_path.

If SearchRequest.EmbeddingSpec.EmbeddingVector.field_path is not provided, it will use [ServingConfig.EmbeddingConfig.field_path][].

Returns:



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#facet_specs::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec>

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

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

Returns:



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#filter::String

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

If this field is unrecognizable, an INVALID_ARGUMENT is returned.

Filtering in Vertex AI Search is done by mapping the LHS filter key to a key property defined in the Vertex AI Search backend -- this mapping is defined by the customer in their schema. For example a media customer might have a field 'name' in their schema. In this case the filter would look like this: filter --> name:'ANY("king kong")'

For more information about filtering including syntax and filter operators, see Filter.

Returns:

  • (::String)

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

    If this field is unrecognizable, an INVALID_ARGUMENT is returned.

    Filtering in Vertex AI Search is done by mapping the LHS filter key to a key property defined in the Vertex AI Search backend -- this mapping is defined by the customer in their schema. For example a media customer might have a field 'name' in their schema. In this case the filter would look like this: filter --> name:'ANY("king kong")'

    For more information about filtering including syntax and filter operators, see Filter



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#image_query::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ImageQuery

Returns Raw image query.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#offset::Integer

Returns A 0-indexed integer that specifies the current offset (that is, starting result location, amongst the Documents 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 Documents 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.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#order_by::String

Returns The order in which documents are returned. Documents can be ordered by a field in an Document object. Leave it unset if ordered by relevance. order_by expression is case-sensitive. For more information on ordering, see Ordering

If this field is unrecognizable, an INVALID_ARGUMENT is returned.

Returns:

  • (::String)

    The order in which documents are returned. Documents can be ordered by a field in an Document object. Leave it unset if ordered by relevance. order_by expression is case-sensitive. For more information on ordering, see Ordering

    If this field is unrecognizable, an INVALID_ARGUMENT is returned.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#page_size::Integer

Returns Maximum number of Documents to return. If unspecified, defaults to a reasonable value. The maximum allowed value is 100. Values above 100 are coerced to 100.

If this field is negative, an INVALID_ARGUMENT is returned.

Returns:

  • (::Integer)

    Maximum number of Documents to return. If unspecified, defaults to a reasonable value. The maximum allowed value is 100. Values above 100 are coerced to 100.

    If this field is negative, an INVALID_ARGUMENT is returned.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#page_token::String

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

  • (::String)

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



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#params::Google::Protobuf::Map{::String => ::Google::Protobuf::Value}

Returns Additional search parameters.

For public website search only, supported values are:

  • user_country_code: string. Default empty. If set to non-empty, results are restricted or boosted based on the location provided. Example: user_country_code: "au"

For available codes see Country Codes

  • search_type: double. Default empty. Enables non-webpage searching depending on the value. The only valid non-default value is 1, which enables image searching. Example: search_type: 1.

Returns:

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

    Additional search parameters.

    For public website search only, supported values are:

    • user_country_code: string. Default empty. If set to non-empty, results are restricted or boosted based on the location provided. Example: user_country_code: "au"

    For available codes see Country Codes

    • search_type: double. Default empty. Enables non-webpage searching depending on the value. The only valid non-default value is 1, which enables image searching. Example: search_type: 1


237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#query::String

Returns Raw search query.

Returns:

  • (::String)

    Raw search query.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#query_expansion_spec::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec

Returns The query expansion specification that specifies the conditions under which query expansion occurs.

Returns:



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#ranking_expression::String

Returns The ranking expression controls the customized ranking on retrieval documents. This overrides ServingConfig.ranking_expression. The ranking expression is a single function or multiple functions that are joint by "+".

  • ranking_expression = function, { " + ", function }; Supported functions:
  • double * relevance_score
  • double * dotProduct(embedding_field_path) Function variables: relevance_score: pre-defined keywords, used for measure relevance between query and document. embedding_field_path: the document embedding field used with query embedding vector. dotProduct: embedding function between embedding_field_path and query embedding vector.

Example ranking expression: If document has an embedding field doc_embedding, the ranking expression could be 0.5 * relevance_score + 0.3 * dotProduct(doc_embedding).

Returns:

  • (::String)

    The ranking expression controls the customized ranking on retrieval documents. This overrides ServingConfig.ranking_expression. The ranking expression is a single function or multiple functions that are joint by "+".

    • ranking_expression = function, { " + ", function }; Supported functions:
    • double * relevance_score
    • double * dotProduct(embedding_field_path) Function variables: relevance_score: pre-defined keywords, used for measure relevance between query and document. embedding_field_path: the document embedding field used with query embedding vector. dotProduct: embedding function between embedding_field_path and query embedding vector.

    Example ranking expression: If document has an embedding field doc_embedding, the ranking expression could be 0.5 * relevance_score + 0.3 * dotProduct(doc_embedding).



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#safe_search::Boolean

Returns Whether to turn on safe search. This is only supported for website search.

Returns:

  • (::Boolean)

    Whether to turn on safe search. This is only supported for website search.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#serving_config::String

Returns Required. The resource name of the Search serving config, such as projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config, or projects/*/locations/global/collections/default_collection/dataStores/default_data_store/servingConfigs/default_serving_config. This field is used to identify the serving configuration name, set of models used to make the search.

Returns:

  • (::String)

    Required. The resource name of the Search serving config, such as projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config, or projects/*/locations/global/collections/default_collection/dataStores/default_data_store/servingConfigs/default_serving_config. This field is used to identify the serving configuration name, set of models used to make the search.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#spell_correction_spec::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec

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

Returns:



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#user_info::Google::Cloud::DiscoveryEngine::V1beta::UserInfo

Returns Information about the end user. Highly recommended for analytics. UserInfo.user_agent is used to deduce device_type for analytics.

Returns:



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

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

Returns The user 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.

See Google Cloud Document for more details.

Returns:

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

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

    See Google Cloud Document for more details.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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

#user_pseudo_id::String

Returns 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 field should NOT have a fixed value such as unknown_visitor.

This should be the same identifier as UserEvent.user_pseudo_id and CompleteQueryRequest.user_pseudo_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)

    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 field should NOT have a fixed value such as unknown_visitor.

    This should be the same identifier as UserEvent.user_pseudo_id and CompleteQueryRequest.user_pseudo_id

    The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
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
# File 'proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb', line 237

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

  # Specifies the image query input.
  # @!attribute [rw] image_bytes
  #   @return [::String]
  #     Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
  #     BMP.
  class ImageQuery
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A struct to define data stores to filter on in a search call.
  # @!attribute [rw] data_store
  #   @return [::String]
  #     Required. Full resource name of
  #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}, such as
  #     `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
  class DataStoreSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # A facet specification to perform faceted search.
  # @!attribute [rw] facet_key
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::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 20. The maximum allowed value is 300. Values
  #     above 300 are 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::DiscoveryEngine::V1beta::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 documents with the color facet "Red"
  #     and 200 documents with the color facet "Blue". A query containing the
  #     filter "color:ANY("Red")" and having "color" as
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#key FacetKey.key}
  #     would by default return only "Red" documents in the search results, and
  #     also return "Red" with count 100 as the only color facet. Although there
  #     are also blue documents available, "Blue" would not be shown as an
  #     available facet value.
  #
  #     If "color" is listed in "excludedFilterKeys", then the query returns the
  #     facet values "Red" with count 100 and "Blue" with count 200, because the
  #     "color" 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" documents.
  #
  #     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 automatically.
  #     If dynamic facets are enabled, it is ordered together.
  #     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
  #     automatically.
  #
  #     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 enabled, 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 API orders "gender" and "rating" facets.
  #     However, notice that "price" and "brands" are always
  #     ranked at first and second position because their enable_dynamic_position
  #     is 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::DiscoveryEngine::V1beta::Document Document} object, over
    #     which the facet values are computed. Facet key is case-sensitive.
    # @!attribute [rw] intervals
    #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::Interval>]
    #     Set only if values should be bucketed into intervals. Must be set
    #     for facets with numerical values. Must not be set for facet with text
    #     values. Maximum number of intervals is 30.
    # @!attribute [rw] restricted_values
    #   @return [::Array<::String>]
    #     Only get facet for the given restricted values. Only supported on
    #     textual fields. For example, suppose "category" has three values
    #     "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
    #     "restricted_values" to "Action > 2022", the "category" facet only
    #     contains "Action > 2022". Only supported on textual fields. Maximum
    #     is 10.
    # @!attribute [rw] prefixes
    #   @return [::Array<::String>]
    #     Only get facet values that start with the given string prefix. For
    #     example, suppose "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
    #     "category" facet only contains "Action > 2022" and "Action > 2021".
    #     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 "category" has three values "Action > 2022",
    #     "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
    #     "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
    #     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 documents are returned.
    #
    #     Allowed values are:
    #
    #     * "count desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count}
    #     descending.
    #
    #     * "value desc", which means order by
    #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}.
    class FacetKey
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # Boost specification to boost certain documents.
  # @!attribute [rw] condition_boost_specs
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec::ConditionBoostSpec>]
  #     Condition boost specifications. If a document matches multiple conditions
  #     in the specifictions, boost scores from these specifications are all
  #     applied and combined in a non-linear way. Maximum number of
  #     specifications is 20.
  class BoostSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Boost applies to documents 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::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}
    #     for detail syntax and limitations.
    #
    #     Examples:
    #
    #     * To boost documents with document ID "doc_1" or "doc_2", and
    #     color "Red" or "Blue":
    #     `(document_id: ANY("doc_1", "doc_2")) AND (color: 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 document a big promotion. However, it does not
    #     necessarily mean that the boosted document will be the top result at
    #     all times, nor that other documents 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 documents.
    #
    #     Setting to -1.0 gives the document a big demotion. However, results
    #     that are deeply relevant might still be shown. The document 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition]
  #     The condition under which query expansion should occur. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
  # @!attribute [rw] pin_unexpanded_results
  #   @return [::Boolean]
  #     Whether to pin unexpanded results. 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::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}.
      CONDITION_UNSPECIFIED = 0

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

      # Automatic query expansion built by the Search API.
      AUTO = 2
    end
  end

  # The specification for query spell correction.
  # @!attribute [rw] mode
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode]
  #     The mode under which spell correction should take effect to
  #     replace the original search query. Default to
  #     {::Google::Cloud::DiscoveryEngine::V1beta::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::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}.
      MODE_UNSPECIFIED = 0

      # Search API will try to find a spell suggestion if there
      # is any and put in the
      # {::Google::Cloud::DiscoveryEngine::V1beta::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 the Search API. Search will
      # be based on the corrected query if found.
      AUTO = 2
    end
  end

  # A specification for configuring the behavior of content search.
  # @!attribute [rw] snippet_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SnippetSpec]
  #     If `snippetSpec` is not specified, snippets are not included in the
  #     search response.
  # @!attribute [rw] summary_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec]
  #     If `summarySpec` is not specified, summaries are not included in the
  #     search response.
  # @!attribute [rw] extractive_content_spec
  #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::ExtractiveContentSpec]
  #     If there is no extractive_content_spec provided, there will be no
  #     extractive answer in the search response.
  class ContentSearchSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # A specification for configuring snippets in a search response.
    # @!attribute [rw] max_snippet_count
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Integer]
    #     [DEPRECATED] This field is deprecated. To control snippet return, use
    #     `return_snippet` field. For backwards compatibility, we will return
    #     snippet if max_snippet_count > 0.
    # @!attribute [rw] reference_only
    #   @deprecated This field is deprecated and may be removed in the next major version update.
    #   @return [::Boolean]
    #     [DEPRECATED] This field is deprecated and will have no affect on the
    #     snippet.
    # @!attribute [rw] return_snippet
    #   @return [::Boolean]
    #     If `true`, then return snippet. If no snippet can be generated, we
    #     return "No snippet is available for this page." A `snippet_status` with
    #     `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
    class SnippetSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A specification for configuring a summary returned in a search
    # response.
    # @!attribute [rw] summary_result_count
    #   @return [::Integer]
    #     The number of top results to generate the summary from. If the number
    #     of results returned is less than `summaryResultCount`, the summary is
    #     generated from all of the results.
    #
    #     At most 10 results can be used to generate a summary.
    # @!attribute [rw] include_citations
    #   @return [::Boolean]
    #     Specifies whether to include citations in the summary. The default
    #     value is `false`.
    #
    #     When this field is set to `true`, summaries include in-line citation
    #     numbers.
    #
    #     Example summary including citations:
    #
    #     BigQuery is Google Cloud's fully managed and completely serverless
    #     enterprise data warehouse [1]. BigQuery supports all data types, works
    #     across clouds, and has built-in machine learning and business
    #     intelligence, all within a unified platform [2, 3].
    #
    #     The citation numbers refer to the returned search results and are
    #     1-indexed. For example, [1] means that the sentence is attributed to
    #     the first search result. [2, 3] means that the sentence is attributed
    #     to both the second and third search results.
    # @!attribute [rw] ignore_adversarial_query
    #   @return [::Boolean]
    #     Specifies whether to filter out adversarial queries. The default value
    #     is `false`.
    #
    #     Google employs search-query classification to detect adversarial
    #     queries. No summary is returned if the search query is classified as an
    #     adversarial query. For example, a user might ask a question regarding
    #     negative comments about the company or submit a query designed to
    #     generate unsafe, policy-violating output. If this field is set to
    #     `true`, we skip generating summaries for adversarial queries and return
    #     fallback messages instead.
    # @!attribute [rw] ignore_non_summary_seeking_query
    #   @return [::Boolean]
    #     Specifies whether to filter out queries that are not summary-seeking.
    #     The default value is `false`.
    #
    #     Google employs search-query classification to detect summary-seeking
    #     queries. No summary is returned if the search query is classified as a
    #     non-summary seeking query. For example, `why is the sky blue` and `Who
    #     is the best soccer player in the world?` are summary-seeking queries,
    #     but `SFO airport` and `world cup 2026` are not. They are most likely
    #     navigational queries. If this field is set to `true`, we skip
    #     generating summaries for non-summary seeking queries and return
    #     fallback messages instead.
    # @!attribute [rw] model_prompt_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelPromptSpec]
    #     If specified, the spec will be used to modify the prompt provided to
    #     the LLM.
    # @!attribute [rw] language_code
    #   @return [::String]
    #     Language code for Summary. Use language tags defined by
    #     [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
    #     Note: This is an experimental feature.
    # @!attribute [rw] model_spec
    #   @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec::ModelSpec]
    #     If specified, the spec will be used to modify the model specification
    #     provided to the LLM.
    class SummarySpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Specification of the prompt to use with the model.
      # @!attribute [rw] preamble
      #   @return [::String]
      #     Text at the beginning of the prompt that instructs the assistant.
      #     Examples are available in the user guide.
      class ModelPromptSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Specification of the model.
      # @!attribute [rw] version
      #   @return [::String]
      #     The model version used to generate the summary.
      #
      #     Supported values are:
      #
      #     * `stable`: string. Default value when no value is specified. Uses a
      #       generally available, fine-tuned version of the text-bison@001
      #       model.
      #     * `preview`: string. (Public preview) Uses a fine-tuned version of
      #       the text-bison@002 model. This model works only for summaries in
      #       English.
      class ModelSpec
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A specification for configuring the extractive content in a search
    # response.
    # @!attribute [rw] max_extractive_answer_count
    #   @return [::Integer]
    #     The maximum number of extractive answers returned in each search
    #     result.
    #
    #     An extractive answer is a verbatim answer extracted from the original
    #     document, which provides a precise and contextually relevant answer to
    #     the search query.
    #
    #     If the number of matching answers is less than the
    #     `max_extractive_answer_count`, return all of the answers. Otherwise,
    #     return the `max_extractive_answer_count`.
    #
    #     At most five answers are returned for each
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult SearchResult}.
    # @!attribute [rw] max_extractive_segment_count
    #   @return [::Integer]
    #     The max number of extractive segments returned in each search result.
    #     Only applied if the
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore} is set to
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore::ContentConfig::CONTENT_REQUIRED DataStore.ContentConfig.CONTENT_REQUIRED}
    #     or
    #     {::Google::Cloud::DiscoveryEngine::V1beta::DataStore#solution_types DataStore.solution_types}
    #     is
    #     {::Google::Cloud::DiscoveryEngine::V1beta::SolutionType::SOLUTION_TYPE_CHAT SOLUTION_TYPE_CHAT}.
    #
    #     An extractive segment is a text segment extracted from the original
    #     document that is relevant to the search query, and, in general, more
    #     verbose than an extractive answer. The segment could then be used as
    #     input for LLMs to generate summaries and answers.
    #
    #     If the number of matching segments is less than
    #     `max_extractive_segment_count`, return all of the segments. Otherwise,
    #     return the `max_extractive_segment_count`.
    # @!attribute [rw] return_extractive_segment_score
    #   @return [::Boolean]
    #     Specifies whether to return the confidence score from the extractive
    #     segments in each search result. The default value is `false`.
    #
    #     Note: this is a priavte preview feature and only works for allowlisted
    #     users, please reach out to Cloud Support team if you want to use it.
    # @!attribute [rw] num_previous_segments
    #   @return [::Integer]
    #     Specifies whether to also include the adjacent from each selected
    #     segments.
    #     Return at most `num_previous_segments` segments before each selected
    #     segments.
    # @!attribute [rw] num_next_segments
    #   @return [::Integer]
    #     Return at most `num_next_segments` segments after each selected
    #     segments.
    class ExtractiveContentSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # The specification that uses customized query embedding vector to do
  # semantic document retrieval.
  # @!attribute [rw] embedding_vectors
  #   @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector>]
  #     The embedding vector used for retrieval. Limit to 1.
  class EmbeddingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Embedding vector.
    # @!attribute [rw] field_path
    #   @return [::String]
    #     Embedding field path in schema.
    # @!attribute [rw] vector
    #   @return [::Array<::Float>]
    #     Query embedding vector.
    class EmbeddingVector
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

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

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