google-cloud-discovery_engine-v1beta 0.15.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -20
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/client.rb +186 -6
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/paths.rb +62 -0
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/client.rb +179 -6
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/service_stub.rb +131 -31
- data/lib/google/cloud/discovery_engine/v1beta/control_service/client.rb +35 -12
- data/lib/google/cloud/discovery_engine/v1beta/control_service/rest/client.rb +35 -12
- data/lib/google/cloud/discovery_engine/v1beta/control_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/client.rb +48 -27
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/client.rb +48 -27
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/service_stub.rb +118 -80
- data/lib/google/cloud/discovery_engine/v1beta/data_store_service/client.rb +31 -6
- data/lib/google/cloud/discovery_engine/v1beta/data_store_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/client.rb +31 -6
- data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +31 -9
- data/lib/google/cloud/discovery_engine/v1beta/document_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/document_service/paths.rb +25 -0
- data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +31 -9
- data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/service_stub.rb +78 -50
- data/lib/google/cloud/discovery_engine/v1beta/engine_service/client.rb +35 -12
- data/lib/google/cloud/discovery_engine/v1beta/engine_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/client.rb +35 -12
- data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/service_stub.rb +78 -50
- data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/client.rb +31 -5
- data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/client.rb +31 -5
- data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/service_stub.rb +46 -26
- data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/client.rb +244 -6
- data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/paths.rb +85 -0
- data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/client.rb +152 -6
- data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/service_stub.rb +83 -7
- data/lib/google/cloud/discovery_engine/v1beta/project_service/client.rb +29 -2
- data/lib/google/cloud/discovery_engine/v1beta/project_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/client.rb +29 -2
- data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/discovery_engine/v1beta/rank_service/client.rb +29 -3
- data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/client.rb +29 -3
- data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/client.rb +28 -2
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/client.rb +28 -2
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/client.rb +30 -7
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/client.rb +30 -7
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/service_stub.rb +62 -38
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/client.rb +29 -6
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest/client.rb +29 -6
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/client.rb +32 -6
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/client.rb +32 -6
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +427 -3
- data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +417 -3
- data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/service_stub.rb +99 -7
- data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/client.rb +29 -3
- data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/client.rb +29 -3
- data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/service_stub.rb +30 -14
- data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/client.rb +31 -6
- data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest/client.rb +31 -6
- data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest/service_stub.rb +38 -20
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/client.rb +361 -14
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/paths.rb +49 -0
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/client.rb +340 -14
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/service_stub.rb +308 -73
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/client.rb +31 -6
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/client.rb +31 -6
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/service_stub.rb +46 -26
- data/lib/google/cloud/discovery_engine/v1beta/version.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/answer_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/common_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/completion_service_pb.rb +18 -1
- data/lib/google/cloud/discoveryengine/v1beta/completion_service_services_pb.rb +2 -0
- data/lib/google/cloud/discoveryengine/v1beta/control_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_pb.rb +4 -1
- data/lib/google/cloud/discoveryengine/v1beta/custom_tuning_model_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/data_store_pb.rb +7 -1
- data/lib/google/cloud/discoveryengine/v1beta/document_service_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1beta/engine_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_pb.rb +24 -1
- data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_services_pb.rb +4 -0
- data/lib/google/cloud/discoveryengine/v1beta/grounding_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +3 -1
- data/lib/google/cloud/discoveryengine/v1beta/search_service_services_pb.rb +14 -0
- data/lib/google/cloud/discoveryengine/v1beta/serving_config_pb.rb +2 -2
- data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_service_pb.rb +10 -1
- data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_service_services_pb.rb +7 -0
- data/lib/google/cloud/discoveryengine/v1beta/user_event_pb.rb +1 -1
- data/proto_docs/google/api/client.rb +39 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/answer.rb +20 -6
- data/proto_docs/google/cloud/discoveryengine/v1beta/completion_service.rb +268 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/control.rb +9 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/control_service.rb +6 -6
- data/proto_docs/google/cloud/discoveryengine/v1beta/conversational_search_service.rb +95 -15
- data/proto_docs/google/cloud/discoveryengine/v1beta/custom_tuning_model.rb +8 -3
- data/proto_docs/google/cloud/discoveryengine/v1beta/data_store.rb +131 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/document_processing_config.rb +7 -5
- data/proto_docs/google/cloud/discoveryengine/v1beta/document_service.rb +19 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/engine.rb +5 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/engine_service.rb +4 -4
- data/proto_docs/google/cloud/discoveryengine/v1beta/grounded_generation_service.rb +396 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/grounding.rb +10 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/project.rb +1 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/purge_config.rb +1 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/rank_service.rb +1 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +71 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/serving_config.rb +16 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/serving_config_service.rb +2 -2
- data/proto_docs/google/cloud/discoveryengine/v1beta/site_search_engine.rb +17 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/site_search_engine_service.rb +147 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/user_event.rb +9 -1
- data/proto_docs/google/longrunning/operations.rb +19 -14
- metadata +5 -5
@@ -156,14 +156,26 @@ module Google
|
|
156
156
|
endpoint: @config.endpoint,
|
157
157
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
158
158
|
universe_domain: @config.universe_domain,
|
159
|
-
credentials: credentials
|
159
|
+
credentials: credentials,
|
160
|
+
logger: @config.logger
|
160
161
|
)
|
161
162
|
|
163
|
+
@search_service_stub.logger(stub: true)&.info do |entry|
|
164
|
+
entry.set_system_name
|
165
|
+
entry.set_service
|
166
|
+
entry.message = "Created client for #{entry.service}"
|
167
|
+
entry.set_credentials_fields credentials
|
168
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
169
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
170
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
171
|
+
end
|
172
|
+
|
162
173
|
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
163
174
|
config.credentials = credentials
|
164
175
|
config.quota_project = @quota_project_id
|
165
176
|
config.endpoint = @search_service_stub.endpoint
|
166
177
|
config.universe_domain = @search_service_stub.universe_domain
|
178
|
+
config.logger = @search_service_stub.logger if config.respond_to? :logger=
|
167
179
|
end
|
168
180
|
end
|
169
181
|
|
@@ -174,6 +186,15 @@ module Google
|
|
174
186
|
#
|
175
187
|
attr_reader :location_client
|
176
188
|
|
189
|
+
##
|
190
|
+
# The logger used for request/response debug logging.
|
191
|
+
#
|
192
|
+
# @return [Logger]
|
193
|
+
#
|
194
|
+
def logger
|
195
|
+
@search_service_stub.logger
|
196
|
+
end
|
197
|
+
|
177
198
|
# Service calls
|
178
199
|
|
179
200
|
##
|
@@ -189,7 +210,7 @@ module Google
|
|
189
210
|
# @param options [::Gapic::CallOptions, ::Hash]
|
190
211
|
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
191
212
|
#
|
192
|
-
# @overload search(serving_config: nil, branch: nil, query: nil, image_query: nil, page_size: nil, page_token: nil, offset: nil, data_store_specs: nil, filter: nil, canonical_filter: nil, order_by: nil, user_info: nil, language_code: nil, region_code: nil, facet_specs: nil, boost_spec: nil, params: nil, query_expansion_spec: nil, spell_correction_spec: nil, user_pseudo_id: nil, content_search_spec: nil, embedding_spec: nil, ranking_expression: nil, safe_search: nil, user_labels: nil, natural_language_query_understanding_spec: nil, search_as_you_type_spec: nil, session: nil, session_spec: nil, relevance_threshold: nil)
|
213
|
+
# @overload search(serving_config: nil, branch: nil, query: nil, image_query: nil, page_size: nil, page_token: nil, offset: nil, one_box_page_size: nil, data_store_specs: nil, filter: nil, canonical_filter: nil, order_by: nil, user_info: nil, language_code: nil, region_code: nil, facet_specs: nil, boost_spec: nil, params: nil, query_expansion_spec: nil, spell_correction_spec: nil, user_pseudo_id: nil, content_search_spec: nil, embedding_spec: nil, ranking_expression: nil, safe_search: nil, user_labels: nil, natural_language_query_understanding_spec: nil, search_as_you_type_spec: nil, session: nil, session_spec: nil, relevance_threshold: nil, personalization_spec: nil)
|
193
214
|
# Pass arguments to `search` via keyword arguments. Note that at
|
194
215
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
195
216
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -239,6 +260,10 @@ module Google
|
|
239
260
|
# is unset.
|
240
261
|
#
|
241
262
|
# If this field is negative, an `INVALID_ARGUMENT` is returned.
|
263
|
+
# @param one_box_page_size [::Integer]
|
264
|
+
# The maximum number of results to return for OneBox.
|
265
|
+
# This applies to each OneBox type individually.
|
266
|
+
# Default number is 10.
|
242
267
|
# @param data_store_specs [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::DataStoreSpec, ::Hash>]
|
243
268
|
# Specs defining dataStores to filter on in a search call and configurations
|
244
269
|
# for those dataStores. This is only considered for engines with multiple
|
@@ -453,6 +478,17 @@ module Google
|
|
453
478
|
# Default to Google defined threshold, leveraging a balance of
|
454
479
|
# precision and recall to deliver both highly accurate results and
|
455
480
|
# comprehensive coverage of relevant information.
|
481
|
+
# @param personalization_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::PersonalizationSpec, ::Hash]
|
482
|
+
# The specification for personalization.
|
483
|
+
#
|
484
|
+
# Notice that if both
|
485
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}
|
486
|
+
# and
|
487
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
|
488
|
+
# are set,
|
489
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
|
490
|
+
# overrides
|
491
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}.
|
456
492
|
# @yield [result, operation] Access the result along with the TransportOperation object
|
457
493
|
# @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse]
|
458
494
|
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
@@ -510,7 +546,372 @@ module Google
|
|
510
546
|
|
511
547
|
@search_service_stub.search request, options do |result, operation|
|
512
548
|
yield result, operation if block_given?
|
513
|
-
|
549
|
+
end
|
550
|
+
rescue ::Gapic::Rest::Error => e
|
551
|
+
raise ::Google::Cloud::Error.from_error(e)
|
552
|
+
end
|
553
|
+
|
554
|
+
##
|
555
|
+
# Performs a search. Similar to the
|
556
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Rest::Client#search SearchService.Search}
|
557
|
+
# method, but a lite version that allows API key for authentication, where
|
558
|
+
# OAuth and IAM checks are not required.
|
559
|
+
#
|
560
|
+
# Only public website search is supported by this method. If data stores and
|
561
|
+
# engines not associated with public website search are specified, a
|
562
|
+
# `FAILED_PRECONDITION` error is returned.
|
563
|
+
#
|
564
|
+
# This method can be used for easy onboarding without having to implement an
|
565
|
+
# authentication backend. However, it is strongly recommended to use
|
566
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Rest::Client#search SearchService.Search}
|
567
|
+
# instead with required OAuth and IAM checks to provide better data security.
|
568
|
+
#
|
569
|
+
# @overload search_lite(request, options = nil)
|
570
|
+
# Pass arguments to `search_lite` via a request object, either of type
|
571
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest} or an equivalent Hash.
|
572
|
+
#
|
573
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest, ::Hash]
|
574
|
+
# A request object representing the call parameters. Required. To specify no
|
575
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
576
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
577
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
578
|
+
#
|
579
|
+
# @overload search_lite(serving_config: nil, branch: nil, query: nil, image_query: nil, page_size: nil, page_token: nil, offset: nil, one_box_page_size: nil, data_store_specs: nil, filter: nil, canonical_filter: nil, order_by: nil, user_info: nil, language_code: nil, region_code: nil, facet_specs: nil, boost_spec: nil, params: nil, query_expansion_spec: nil, spell_correction_spec: nil, user_pseudo_id: nil, content_search_spec: nil, embedding_spec: nil, ranking_expression: nil, safe_search: nil, user_labels: nil, natural_language_query_understanding_spec: nil, search_as_you_type_spec: nil, session: nil, session_spec: nil, relevance_threshold: nil, personalization_spec: nil)
|
580
|
+
# Pass arguments to `search_lite` via keyword arguments. Note that at
|
581
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
582
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
583
|
+
#
|
584
|
+
# @param serving_config [::String]
|
585
|
+
# Required. The resource name of the Search serving config, such as
|
586
|
+
# `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`,
|
587
|
+
# or
|
588
|
+
# `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/servingConfigs/default_serving_config`.
|
589
|
+
# This field is used to identify the serving configuration name, set
|
590
|
+
# of models used to make the search.
|
591
|
+
# @param branch [::String]
|
592
|
+
# The branch resource name, such as
|
593
|
+
# `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/branches/0`.
|
594
|
+
#
|
595
|
+
# Use `default_branch` as the branch ID or leave this field empty, to search
|
596
|
+
# documents under the default branch.
|
597
|
+
# @param query [::String]
|
598
|
+
# Raw search query.
|
599
|
+
# @param image_query [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ImageQuery, ::Hash]
|
600
|
+
# Raw image query.
|
601
|
+
# @param page_size [::Integer]
|
602
|
+
# Maximum number of {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s
|
603
|
+
# to return. The maximum allowed value depends on the data type. Values above
|
604
|
+
# the maximum value are coerced to the maximum value.
|
605
|
+
#
|
606
|
+
# * Websites with basic indexing: Default `10`, Maximum `25`.
|
607
|
+
# * Websites with advanced indexing: Default `25`, Maximum `50`.
|
608
|
+
# * Other: Default `50`, Maximum `100`.
|
609
|
+
#
|
610
|
+
# If this field is negative, an `INVALID_ARGUMENT` is returned.
|
611
|
+
# @param page_token [::String]
|
612
|
+
# A page token received from a previous
|
613
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Rest::Client#search SearchService.Search}
|
614
|
+
# call. Provide this to retrieve the subsequent page.
|
615
|
+
#
|
616
|
+
# When paginating, all other parameters provided to
|
617
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Rest::Client#search SearchService.Search}
|
618
|
+
# must match the call that provided the page token. Otherwise, an
|
619
|
+
# `INVALID_ARGUMENT` error is returned.
|
620
|
+
# @param offset [::Integer]
|
621
|
+
# A 0-indexed integer that specifies the current offset (that is, starting
|
622
|
+
# result location, amongst the
|
623
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s deemed by the API
|
624
|
+
# as relevant) in search results. This field is only considered if
|
625
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#page_token page_token}
|
626
|
+
# is unset.
|
627
|
+
#
|
628
|
+
# If this field is negative, an `INVALID_ARGUMENT` is returned.
|
629
|
+
# @param one_box_page_size [::Integer]
|
630
|
+
# The maximum number of results to return for OneBox.
|
631
|
+
# This applies to each OneBox type individually.
|
632
|
+
# Default number is 10.
|
633
|
+
# @param data_store_specs [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::DataStoreSpec, ::Hash>]
|
634
|
+
# Specs defining dataStores to filter on in a search call and configurations
|
635
|
+
# for those dataStores. This is only considered for engines with multiple
|
636
|
+
# dataStores use case. For single dataStore within an engine, they should
|
637
|
+
# use the specs at the top level.
|
638
|
+
# @param filter [::String]
|
639
|
+
# The filter syntax consists of an expression language for constructing a
|
640
|
+
# predicate from one or more fields of the documents being filtered. Filter
|
641
|
+
# expression is case-sensitive.
|
642
|
+
#
|
643
|
+
# If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
|
644
|
+
#
|
645
|
+
# Filtering in Vertex AI Search is done by mapping the LHS filter key to a
|
646
|
+
# key property defined in the Vertex AI Search backend -- this mapping is
|
647
|
+
# defined by the customer in their schema. For example a media customer might
|
648
|
+
# have a field 'name' in their schema. In this case the filter would look
|
649
|
+
# like this: filter --> name:'ANY("king kong")'
|
650
|
+
#
|
651
|
+
# For more information about filtering including syntax and filter
|
652
|
+
# operators, see
|
653
|
+
# [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata)
|
654
|
+
# @param canonical_filter [::String]
|
655
|
+
# The default filter that is applied when a user performs a search without
|
656
|
+
# checking any filters on the search page.
|
657
|
+
#
|
658
|
+
# The filter applied to every search request when quality improvement such as
|
659
|
+
# query expansion is needed. In the case a query does not have a sufficient
|
660
|
+
# amount of results this filter will be used to determine whether or not to
|
661
|
+
# enable the query expansion flow. The original filter will still be used for
|
662
|
+
# the query expanded search.
|
663
|
+
# This field is strongly recommended to achieve high search quality.
|
664
|
+
#
|
665
|
+
# For more information about filter syntax, see
|
666
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}.
|
667
|
+
# @param order_by [::String]
|
668
|
+
# The order in which documents are returned. Documents can be ordered by
|
669
|
+
# a field in an {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}
|
670
|
+
# object. Leave it unset if ordered by relevance. `order_by` expression is
|
671
|
+
# case-sensitive.
|
672
|
+
#
|
673
|
+
# For more information on ordering the website search results, see
|
674
|
+
# [Order web search
|
675
|
+
# results](https://cloud.google.com/generative-ai-app-builder/docs/order-web-search-results).
|
676
|
+
# For more information on ordering the healthcare search results, see
|
677
|
+
# [Order healthcare search
|
678
|
+
# results](https://cloud.google.com/generative-ai-app-builder/docs/order-hc-results).
|
679
|
+
# If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
|
680
|
+
# @param user_info [::Google::Cloud::DiscoveryEngine::V1beta::UserInfo, ::Hash]
|
681
|
+
# Information about the end user.
|
682
|
+
# Highly recommended for analytics.
|
683
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::UserInfo#user_agent UserInfo.user_agent}
|
684
|
+
# is used to deduce `device_type` for analytics.
|
685
|
+
# @param language_code [::String]
|
686
|
+
# The BCP-47 language code, such as "en-US" or "sr-Latn". For more
|
687
|
+
# information, see [Standard
|
688
|
+
# fields](https://cloud.google.com/apis/design/standard_fields). This field
|
689
|
+
# helps to better interpret the query. If a value isn't specified, the query
|
690
|
+
# language code is automatically detected, which may not be accurate.
|
691
|
+
# @param region_code [::String]
|
692
|
+
# The Unicode country/region code (CLDR) of a location, such as "US" and
|
693
|
+
# "419". For more information, see [Standard
|
694
|
+
# fields](https://cloud.google.com/apis/design/standard_fields). If set,
|
695
|
+
# then results will be boosted based on the region_code provided.
|
696
|
+
# @param facet_specs [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec, ::Hash>]
|
697
|
+
# Facet specifications for faceted search. If empty, no facets are returned.
|
698
|
+
#
|
699
|
+
# A maximum of 100 values are allowed. Otherwise, an `INVALID_ARGUMENT`
|
700
|
+
# error is returned.
|
701
|
+
# @param boost_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec, ::Hash]
|
702
|
+
# Boost specification to boost certain documents.
|
703
|
+
# For more information on boosting, see
|
704
|
+
# [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results)
|
705
|
+
# @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}]
|
706
|
+
# Additional search parameters.
|
707
|
+
#
|
708
|
+
# For public website search only, supported values are:
|
709
|
+
#
|
710
|
+
# * `user_country_code`: string. Default empty. If set to non-empty, results
|
711
|
+
# are restricted or boosted based on the location provided.
|
712
|
+
# For example, `user_country_code: "au"`
|
713
|
+
#
|
714
|
+
# For available codes see [Country
|
715
|
+
# Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes)
|
716
|
+
#
|
717
|
+
# * `search_type`: double. Default empty. Enables non-webpage searching
|
718
|
+
# depending on the value. The only valid non-default value is 1,
|
719
|
+
# which enables image searching.
|
720
|
+
# For example, `search_type: 1`
|
721
|
+
# @param query_expansion_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec, ::Hash]
|
722
|
+
# The query expansion specification that specifies the conditions under which
|
723
|
+
# query expansion occurs.
|
724
|
+
# @param spell_correction_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec, ::Hash]
|
725
|
+
# The spell correction specification that specifies the mode under
|
726
|
+
# which spell correction takes effect.
|
727
|
+
# @param user_pseudo_id [::String]
|
728
|
+
# A unique identifier for tracking visitors. For example, this could be
|
729
|
+
# implemented with an HTTP cookie, which should be able to uniquely identify
|
730
|
+
# a visitor on a single device. This unique identifier should not change if
|
731
|
+
# the visitor logs in or out of the website.
|
732
|
+
#
|
733
|
+
# This field should NOT have a fixed value such as `unknown_visitor`.
|
734
|
+
#
|
735
|
+
# This should be the same identifier as
|
736
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::UserEvent#user_pseudo_id UserEvent.user_pseudo_id}
|
737
|
+
# and
|
738
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryRequest#user_pseudo_id CompleteQueryRequest.user_pseudo_id}
|
739
|
+
#
|
740
|
+
# The field must be a UTF-8 encoded string with a length limit of 128
|
741
|
+
# characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
|
742
|
+
# @param content_search_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec, ::Hash]
|
743
|
+
# A specification for configuring the behavior of content search.
|
744
|
+
# @param embedding_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec, ::Hash]
|
745
|
+
# Uses the provided embedding to do additional semantic document retrieval.
|
746
|
+
# The retrieval is based on the dot product of
|
747
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector#vector SearchRequest.EmbeddingSpec.EmbeddingVector.vector}
|
748
|
+
# and the document embedding that is provided in
|
749
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector#field_path SearchRequest.EmbeddingSpec.EmbeddingVector.field_path}.
|
750
|
+
#
|
751
|
+
# If
|
752
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector#field_path SearchRequest.EmbeddingSpec.EmbeddingVector.field_path}
|
753
|
+
# is not provided, it will use
|
754
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#embedding_config ServingConfig.EmbeddingConfig.field_path}.
|
755
|
+
# @param ranking_expression [::String]
|
756
|
+
# The ranking expression controls the customized ranking on retrieval
|
757
|
+
# documents. This overrides
|
758
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#ranking_expression ServingConfig.ranking_expression}.
|
759
|
+
# The ranking expression is a single function or multiple functions that are
|
760
|
+
# joined by "+".
|
761
|
+
#
|
762
|
+
# * ranking_expression = function, { " + ", function };
|
763
|
+
#
|
764
|
+
# Supported functions:
|
765
|
+
#
|
766
|
+
# * double * relevance_score
|
767
|
+
# * double * dotProduct(embedding_field_path)
|
768
|
+
#
|
769
|
+
# Function variables:
|
770
|
+
#
|
771
|
+
# * `relevance_score`: pre-defined keywords, used for measure relevance
|
772
|
+
# between query and document.
|
773
|
+
# * `embedding_field_path`: the document embedding field
|
774
|
+
# used with query embedding vector.
|
775
|
+
# * `dotProduct`: embedding function between embedding_field_path and query
|
776
|
+
# embedding vector.
|
777
|
+
#
|
778
|
+
# Example ranking expression:
|
779
|
+
#
|
780
|
+
# If document has an embedding field doc_embedding, the ranking expression
|
781
|
+
# could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
782
|
+
# @param safe_search [::Boolean]
|
783
|
+
# Whether to turn on safe search. This is only supported for
|
784
|
+
# website search.
|
785
|
+
# @param user_labels [::Hash{::String => ::String}]
|
786
|
+
# The user labels applied to a resource must meet the following requirements:
|
787
|
+
#
|
788
|
+
# * Each resource can have multiple labels, up to a maximum of 64.
|
789
|
+
# * Each label must be a key-value pair.
|
790
|
+
# * Keys have a minimum length of 1 character and a maximum length of 63
|
791
|
+
# characters and cannot be empty. Values can be empty and have a maximum
|
792
|
+
# length of 63 characters.
|
793
|
+
# * Keys and values can contain only lowercase letters, numeric characters,
|
794
|
+
# underscores, and dashes. All characters must use UTF-8 encoding, and
|
795
|
+
# international characters are allowed.
|
796
|
+
# * The key portion of a label must be unique. However, you can use the same
|
797
|
+
# key with multiple resources.
|
798
|
+
# * Keys must start with a lowercase letter or international character.
|
799
|
+
#
|
800
|
+
# See [Google Cloud
|
801
|
+
# Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
|
802
|
+
# for more details.
|
803
|
+
# @param natural_language_query_understanding_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::NaturalLanguageQueryUnderstandingSpec, ::Hash]
|
804
|
+
# If `naturalLanguageQueryUnderstandingSpec` is not specified, no additional
|
805
|
+
# natural language query understanding will be done.
|
806
|
+
# @param search_as_you_type_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SearchAsYouTypeSpec, ::Hash]
|
807
|
+
# Search as you type configuration. Only supported for the
|
808
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::IndustryVertical::MEDIA IndustryVertical.MEDIA}
|
809
|
+
# vertical.
|
810
|
+
# @param session [::String]
|
811
|
+
# The session resource name. Optional.
|
812
|
+
#
|
813
|
+
# Session allows users to do multi-turn /search API calls or coordination
|
814
|
+
# between /search API calls and /answer API calls.
|
815
|
+
#
|
816
|
+
# Example #1 (multi-turn /search API calls):
|
817
|
+
# 1. Call /search API with the auto-session mode (see below).
|
818
|
+
# 2. Call /search API with the session ID generated in the first call.
|
819
|
+
# Here, the previous search query gets considered in query
|
820
|
+
# standing. I.e., if the first query is "How did Alphabet do in 2022?"
|
821
|
+
# and the current query is "How about 2023?", the current query will
|
822
|
+
# be interpreted as "How did Alphabet do in 2023?".
|
823
|
+
#
|
824
|
+
# Example #2 (coordination between /search API calls and /answer API calls):
|
825
|
+
# 1. Call /search API with the auto-session mode (see below).
|
826
|
+
# 2. Call /answer API with the session ID generated in the first call.
|
827
|
+
# Here, the answer generation happens in the context of the search
|
828
|
+
# results from the first search call.
|
829
|
+
#
|
830
|
+
# Auto-session mode: when `projects/.../sessions/-` is used, a new session
|
831
|
+
# gets automatically created. Otherwise, users can use the create-session API
|
832
|
+
# to create a session manually.
|
833
|
+
#
|
834
|
+
# Multi-turn Search feature is currently at private GA stage. Please use
|
835
|
+
# v1alpha or v1beta version instead before we launch this feature to public
|
836
|
+
# GA. Or ask for allowlisting through Google Support team.
|
837
|
+
# @param session_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SessionSpec, ::Hash]
|
838
|
+
# Session specification.
|
839
|
+
#
|
840
|
+
# Can be used only when `session` is set.
|
841
|
+
# @param relevance_threshold [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::RelevanceThreshold]
|
842
|
+
# The relevance threshold of the search results.
|
843
|
+
#
|
844
|
+
# Default to Google defined threshold, leveraging a balance of
|
845
|
+
# precision and recall to deliver both highly accurate results and
|
846
|
+
# comprehensive coverage of relevant information.
|
847
|
+
# @param personalization_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::PersonalizationSpec, ::Hash]
|
848
|
+
# The specification for personalization.
|
849
|
+
#
|
850
|
+
# Notice that if both
|
851
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}
|
852
|
+
# and
|
853
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
|
854
|
+
# are set,
|
855
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
|
856
|
+
# overrides
|
857
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}.
|
858
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
859
|
+
# @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse]
|
860
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
861
|
+
#
|
862
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse]
|
863
|
+
#
|
864
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
865
|
+
#
|
866
|
+
# @example Basic example
|
867
|
+
# require "google/cloud/discovery_engine/v1beta"
|
868
|
+
#
|
869
|
+
# # Create a client object. The client can be reused for multiple calls.
|
870
|
+
# client = Google::Cloud::DiscoveryEngine::V1beta::SearchService::Rest::Client.new
|
871
|
+
#
|
872
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
873
|
+
# request = Google::Cloud::DiscoveryEngine::V1beta::SearchRequest.new
|
874
|
+
#
|
875
|
+
# # Call the search_lite method.
|
876
|
+
# result = client.search_lite request
|
877
|
+
#
|
878
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
879
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
880
|
+
# result.each do |item|
|
881
|
+
# # Each element is of type ::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult.
|
882
|
+
# p item
|
883
|
+
# end
|
884
|
+
#
|
885
|
+
def search_lite request, options = nil
|
886
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
887
|
+
|
888
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest
|
889
|
+
|
890
|
+
# Converts hash and nil to an options object
|
891
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
892
|
+
|
893
|
+
# Customize the options with defaults
|
894
|
+
call_metadata = @config.rpcs.search_lite.metadata.to_h
|
895
|
+
|
896
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
897
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
898
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
899
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
|
900
|
+
transports_version_send: [:rest]
|
901
|
+
|
902
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
903
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
904
|
+
|
905
|
+
options.apply_defaults timeout: @config.rpcs.search_lite.timeout,
|
906
|
+
metadata: call_metadata,
|
907
|
+
retry_policy: @config.rpcs.search_lite.retry_policy
|
908
|
+
|
909
|
+
options.apply_defaults timeout: @config.timeout,
|
910
|
+
metadata: @config.metadata,
|
911
|
+
retry_policy: @config.retry_policy
|
912
|
+
|
913
|
+
@search_service_stub.search_lite request, options do |result, operation|
|
914
|
+
yield result, operation if block_given?
|
514
915
|
end
|
515
916
|
rescue ::Gapic::Rest::Error => e
|
516
917
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -590,6 +991,11 @@ module Google
|
|
590
991
|
# default endpoint URL. The default value of nil uses the environment
|
591
992
|
# universe (usually the default "googleapis.com" universe).
|
592
993
|
# @return [::String,nil]
|
994
|
+
# @!attribute [rw] logger
|
995
|
+
# A custom logger to use for request/response debug logging, or the value
|
996
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
997
|
+
# explicitly disable logging.
|
998
|
+
# @return [::Logger,:default,nil]
|
593
999
|
#
|
594
1000
|
class Configuration
|
595
1001
|
extend ::Gapic::Config
|
@@ -611,6 +1017,7 @@ module Google
|
|
611
1017
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
612
1018
|
config_attr :quota_project, nil, ::String, nil
|
613
1019
|
config_attr :universe_domain, nil, ::String, nil
|
1020
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
614
1021
|
|
615
1022
|
# @private
|
616
1023
|
def initialize parent_config = nil
|
@@ -654,11 +1061,18 @@ module Google
|
|
654
1061
|
# @return [::Gapic::Config::Method]
|
655
1062
|
#
|
656
1063
|
attr_reader :search
|
1064
|
+
##
|
1065
|
+
# RPC-specific configuration for `search_lite`
|
1066
|
+
# @return [::Gapic::Config::Method]
|
1067
|
+
#
|
1068
|
+
attr_reader :search_lite
|
657
1069
|
|
658
1070
|
# @private
|
659
1071
|
def initialize parent_rpcs = nil
|
660
1072
|
search_config = parent_rpcs.search if parent_rpcs.respond_to? :search
|
661
1073
|
@search = ::Gapic::Config::Method.new search_config
|
1074
|
+
search_lite_config = parent_rpcs.search_lite if parent_rpcs.respond_to? :search_lite
|
1075
|
+
@search_lite = ::Gapic::Config::Method.new search_lite_config
|
662
1076
|
|
663
1077
|
yield self if block_given?
|
664
1078
|
end
|
@@ -30,7 +30,8 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
|
33
|
+
# @private
|
34
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
|
34
35
|
# These require statements are intentionally placed here to initialize
|
35
36
|
# the REST modules only when it's required.
|
36
37
|
require "gapic/rest"
|
@@ -40,7 +41,9 @@ module Google
|
|
40
41
|
universe_domain: universe_domain,
|
41
42
|
credentials: credentials,
|
42
43
|
numeric_enums: true,
|
43
|
-
|
44
|
+
service_name: self.class,
|
45
|
+
raise_faraday_errors: false,
|
46
|
+
logger: logger
|
44
47
|
end
|
45
48
|
|
46
49
|
##
|
@@ -61,6 +64,15 @@ module Google
|
|
61
64
|
@client_stub.endpoint
|
62
65
|
end
|
63
66
|
|
67
|
+
##
|
68
|
+
# The logger used for request/response debug logging.
|
69
|
+
#
|
70
|
+
# @return [Logger]
|
71
|
+
#
|
72
|
+
def logger stub: false
|
73
|
+
stub ? @client_stub.stub_logger : @client_stub.logger
|
74
|
+
end
|
75
|
+
|
64
76
|
##
|
65
77
|
# Baseline implementation for the search REST call
|
66
78
|
#
|
@@ -87,16 +99,58 @@ module Google
|
|
87
99
|
|
88
100
|
response = @client_stub.make_http_request(
|
89
101
|
verb,
|
90
|
-
uri:
|
91
|
-
body:
|
92
|
-
params:
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "search",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse.decode_json response.body, ignore_unknown_fields: true
|
110
|
+
catch :response do
|
111
|
+
yield result, operation if block_given?
|
112
|
+
result
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
##
|
117
|
+
# Baseline implementation for the search_lite REST call
|
118
|
+
#
|
119
|
+
# @param request_pb [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest]
|
120
|
+
# A request object representing the call parameters. Required.
|
121
|
+
# @param options [::Gapic::CallOptions]
|
122
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
123
|
+
#
|
124
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
125
|
+
# @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse]
|
126
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
127
|
+
#
|
128
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse]
|
129
|
+
# A result object deserialized from the server's reply
|
130
|
+
def search_lite request_pb, options = nil
|
131
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
97
132
|
|
98
|
-
|
99
|
-
|
133
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_search_lite_request request_pb
|
134
|
+
query_string_params = if query_string_params.any?
|
135
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
136
|
+
else
|
137
|
+
{}
|
138
|
+
end
|
139
|
+
|
140
|
+
response = @client_stub.make_http_request(
|
141
|
+
verb,
|
142
|
+
uri: uri,
|
143
|
+
body: body || "",
|
144
|
+
params: query_string_params,
|
145
|
+
method_name: "search_lite",
|
146
|
+
options: options
|
147
|
+
)
|
148
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
149
|
+
result = ::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse.decode_json response.body, ignore_unknown_fields: true
|
150
|
+
catch :response do
|
151
|
+
yield result, operation if block_given?
|
152
|
+
result
|
153
|
+
end
|
100
154
|
end
|
101
155
|
|
102
156
|
##
|
@@ -136,6 +190,44 @@ module Google
|
|
136
190
|
)
|
137
191
|
transcoder.transcode request_pb
|
138
192
|
end
|
193
|
+
|
194
|
+
##
|
195
|
+
# @private
|
196
|
+
#
|
197
|
+
# GRPC transcoding helper method for the search_lite REST call
|
198
|
+
#
|
199
|
+
# @param request_pb [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest]
|
200
|
+
# A request object representing the call parameters. Required.
|
201
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
202
|
+
# Uri, Body, Query string parameters
|
203
|
+
def self.transcode_search_lite_request request_pb
|
204
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
205
|
+
.with_bindings(
|
206
|
+
uri_method: :post,
|
207
|
+
uri_template: "/v1beta/{serving_config}:searchLite",
|
208
|
+
body: "*",
|
209
|
+
matches: [
|
210
|
+
["serving_config", %r{^projects/[^/]+/locations/[^/]+/dataStores/[^/]+/servingConfigs/[^/]+/?$}, false]
|
211
|
+
]
|
212
|
+
)
|
213
|
+
.with_bindings(
|
214
|
+
uri_method: :post,
|
215
|
+
uri_template: "/v1beta/{serving_config}:searchLite",
|
216
|
+
body: "*",
|
217
|
+
matches: [
|
218
|
+
["serving_config", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/servingConfigs/[^/]+/?$}, false]
|
219
|
+
]
|
220
|
+
)
|
221
|
+
.with_bindings(
|
222
|
+
uri_method: :post,
|
223
|
+
uri_template: "/v1beta/{serving_config}:searchLite",
|
224
|
+
body: "*",
|
225
|
+
matches: [
|
226
|
+
["serving_config", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/engines/[^/]+/servingConfigs/[^/]+/?$}, false]
|
227
|
+
]
|
228
|
+
)
|
229
|
+
transcoder.transcode request_pb
|
230
|
+
end
|
139
231
|
end
|
140
232
|
end
|
141
233
|
end
|