google-cloud-discovery_engine-v1 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/discovery_engine/v1/completion_service/client.rb +33 -4
  4. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/client.rb +39 -3
  5. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +968 -0
  6. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/credentials.rb +47 -0
  7. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/paths.rb +176 -0
  8. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +897 -0
  9. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/service_stub.rb +450 -0
  10. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest.rb +52 -0
  11. data/lib/google/cloud/discovery_engine/v1/conversational_search_service.rb +55 -0
  12. data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +33 -9
  13. data/lib/google/cloud/discovery_engine/v1/document_service/operations.rb +10 -1
  14. data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +153 -8
  15. data/lib/google/cloud/discovery_engine/v1/document_service/rest/operations.rb +117 -0
  16. data/lib/google/cloud/discovery_engine/v1/rest.rb +2 -1
  17. data/lib/google/cloud/discovery_engine/v1/schema_service/client.rb +24 -1
  18. data/lib/google/cloud/discovery_engine/v1/schema_service/operations.rb +10 -1
  19. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/client.rb +119 -0
  20. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/operations.rb +117 -0
  21. data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +55 -10
  22. data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +67 -12
  23. data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +29 -6
  24. data/lib/google/cloud/discovery_engine/v1/user_event_service/operations.rb +10 -1
  25. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +74 -5
  26. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/operations.rb +117 -0
  27. data/lib/google/cloud/discovery_engine/v1/version.rb +1 -1
  28. data/lib/google/cloud/discovery_engine/v1.rb +2 -1
  29. data/lib/google/cloud/discoveryengine/v1/common_pb.rb +2 -1
  30. data/lib/google/cloud/discoveryengine/v1/completion_service_pb.rb +1 -1
  31. data/lib/google/cloud/discoveryengine/v1/conversation_pb.rb +54 -0
  32. data/lib/google/cloud/discoveryengine/v1/conversational_search_service_pb.rb +61 -0
  33. data/lib/google/cloud/discoveryengine/v1/conversational_search_service_services_pb.rb +67 -0
  34. data/lib/google/cloud/discoveryengine/v1/import_config_pb.rb +1 -1
  35. data/lib/google/cloud/discoveryengine/v1/search_service_pb.rb +13 -1
  36. data/lib/google/cloud/discoveryengine/v1/user_event_pb.rb +1 -1
  37. data/lib/google/cloud/discoveryengine/v1/user_event_service_services_pb.rb +1 -1
  38. data/proto_docs/google/api/field_behavior.rb +14 -0
  39. data/proto_docs/google/cloud/discoveryengine/v1/common.rb +19 -2
  40. data/proto_docs/google/cloud/discoveryengine/v1/completion_service.rb +15 -2
  41. data/proto_docs/google/cloud/discoveryengine/v1/conversation.rb +113 -0
  42. data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +206 -0
  43. data/proto_docs/google/cloud/discoveryengine/v1/document.rb +8 -5
  44. data/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +4 -3
  45. data/proto_docs/google/cloud/discoveryengine/v1/import_config.rb +23 -19
  46. data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +455 -19
  47. data/proto_docs/google/cloud/discoveryengine/v1/user_event.rb +44 -32
  48. data/proto_docs/google/cloud/discoveryengine/v1/user_event_service.rb +1 -1
  49. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  50. metadata +38 -5
@@ -19,6 +19,7 @@
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/discoveryengine/v1/schema_service_pb"
21
21
  require "google/cloud/discovery_engine/v1/schema_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
22
23
 
23
24
  module Google
24
25
  module Cloud
@@ -141,6 +142,12 @@ module Google
141
142
  config.endpoint = @config.endpoint
142
143
  end
143
144
 
145
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
146
+ config.credentials = credentials
147
+ config.quota_project = @quota_project_id
148
+ config.endpoint = @config.endpoint
149
+ end
150
+
144
151
  @schema_service_stub = ::Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
145
152
  end
146
153
 
@@ -151,6 +158,13 @@ module Google
151
158
  #
152
159
  attr_reader :operations_client
153
160
 
161
+ ##
162
+ # Get the associated client for mix-in of the Locations.
163
+ #
164
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
165
+ #
166
+ attr_reader :location_client
167
+
154
168
  # Service calls
155
169
 
156
170
  ##
@@ -181,6 +195,22 @@ module Google
181
195
  # @return [::Google::Cloud::DiscoveryEngine::V1::Schema]
182
196
  #
183
197
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
198
+ #
199
+ # @example Basic example
200
+ # require "google/cloud/discovery_engine/v1"
201
+ #
202
+ # # Create a client object. The client can be reused for multiple calls.
203
+ # client = Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client.new
204
+ #
205
+ # # Create a request. To set request fields, pass in keyword arguments.
206
+ # request = Google::Cloud::DiscoveryEngine::V1::GetSchemaRequest.new
207
+ #
208
+ # # Call the get_schema method.
209
+ # result = client.get_schema request
210
+ #
211
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1::Schema.
212
+ # p result
213
+ #
184
214
  def get_schema request, options = nil
185
215
  raise ::ArgumentError, "request must be provided" if request.nil?
186
216
 
@@ -260,6 +290,26 @@ module Google
260
290
  # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Schema>]
261
291
  #
262
292
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
293
+ #
294
+ # @example Basic example
295
+ # require "google/cloud/discovery_engine/v1"
296
+ #
297
+ # # Create a client object. The client can be reused for multiple calls.
298
+ # client = Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client.new
299
+ #
300
+ # # Create a request. To set request fields, pass in keyword arguments.
301
+ # request = Google::Cloud::DiscoveryEngine::V1::ListSchemasRequest.new
302
+ #
303
+ # # Call the list_schemas method.
304
+ # result = client.list_schemas request
305
+ #
306
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
307
+ # # over elements, and API calls will be issued to fetch pages as needed.
308
+ # result.each do |item|
309
+ # # Each element is of type ::Google::Cloud::DiscoveryEngine::V1::Schema.
310
+ # p item
311
+ # end
312
+ #
263
313
  def list_schemas request, options = nil
264
314
  raise ::ArgumentError, "request must be provided" if request.nil?
265
315
 
@@ -335,6 +385,29 @@ module Google
335
385
  # @return [::Gapic::Operation]
336
386
  #
337
387
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
388
+ #
389
+ # @example Basic example
390
+ # require "google/cloud/discovery_engine/v1"
391
+ #
392
+ # # Create a client object. The client can be reused for multiple calls.
393
+ # client = Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client.new
394
+ #
395
+ # # Create a request. To set request fields, pass in keyword arguments.
396
+ # request = Google::Cloud::DiscoveryEngine::V1::CreateSchemaRequest.new
397
+ #
398
+ # # Call the create_schema method.
399
+ # result = client.create_schema request
400
+ #
401
+ # # The returned object is of type Gapic::Operation. You can use it to
402
+ # # check the status of an operation, cancel it, or wait for results.
403
+ # # Here is how to wait for a response.
404
+ # result.wait_until_done! timeout: 60
405
+ # if result.response?
406
+ # p result.response
407
+ # else
408
+ # puts "No response received."
409
+ # end
410
+ #
338
411
  def create_schema request, options = nil
339
412
  raise ::ArgumentError, "request must be provided" if request.nil?
340
413
 
@@ -402,6 +475,29 @@ module Google
402
475
  # @return [::Gapic::Operation]
403
476
  #
404
477
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
478
+ #
479
+ # @example Basic example
480
+ # require "google/cloud/discovery_engine/v1"
481
+ #
482
+ # # Create a client object. The client can be reused for multiple calls.
483
+ # client = Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client.new
484
+ #
485
+ # # Create a request. To set request fields, pass in keyword arguments.
486
+ # request = Google::Cloud::DiscoveryEngine::V1::UpdateSchemaRequest.new
487
+ #
488
+ # # Call the update_schema method.
489
+ # result = client.update_schema request
490
+ #
491
+ # # The returned object is of type Gapic::Operation. You can use it to
492
+ # # check the status of an operation, cancel it, or wait for results.
493
+ # # Here is how to wait for a response.
494
+ # result.wait_until_done! timeout: 60
495
+ # if result.response?
496
+ # p result.response
497
+ # else
498
+ # puts "No response received."
499
+ # end
500
+ #
405
501
  def update_schema request, options = nil
406
502
  raise ::ArgumentError, "request must be provided" if request.nil?
407
503
 
@@ -466,6 +562,29 @@ module Google
466
562
  # @return [::Gapic::Operation]
467
563
  #
468
564
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
565
+ #
566
+ # @example Basic example
567
+ # require "google/cloud/discovery_engine/v1"
568
+ #
569
+ # # Create a client object. The client can be reused for multiple calls.
570
+ # client = Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client.new
571
+ #
572
+ # # Create a request. To set request fields, pass in keyword arguments.
573
+ # request = Google::Cloud::DiscoveryEngine::V1::DeleteSchemaRequest.new
574
+ #
575
+ # # Call the delete_schema method.
576
+ # result = client.delete_schema request
577
+ #
578
+ # # The returned object is of type Gapic::Operation. You can use it to
579
+ # # check the status of an operation, cancel it, or wait for results.
580
+ # # Here is how to wait for a response.
581
+ # result.wait_until_done! timeout: 60
582
+ # if result.response?
583
+ # p result.response
584
+ # else
585
+ # puts "No response received."
586
+ # end
587
+ #
469
588
  def delete_schema request, options = nil
470
589
  raise ::ArgumentError, "request must be provided" if request.nil?
471
590
 
@@ -136,6 +136,26 @@ module Google
136
136
  # @return [::Gapic::Operation]
137
137
  #
138
138
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
139
+ #
140
+ # @example Basic example
141
+ # require "google/longrunning"
142
+ #
143
+ # # Create a client object. The client can be reused for multiple calls.
144
+ # client = Google::Longrunning::Operations::Rest::Client.new
145
+ #
146
+ # # Create a request. To set request fields, pass in keyword arguments.
147
+ # request = Google::Longrunning::ListOperationsRequest.new
148
+ #
149
+ # # Call the list_operations method.
150
+ # result = client.list_operations request
151
+ #
152
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
153
+ # # over elements, and API calls will be issued to fetch pages as needed.
154
+ # result.each do |item|
155
+ # # Each element is of type ::Google::Longrunning::Operation.
156
+ # p item
157
+ # end
158
+ #
139
159
  def list_operations request, options = nil
140
160
  raise ::ArgumentError, "request must be provided" if request.nil?
141
161
 
@@ -201,6 +221,29 @@ module Google
201
221
  # @return [::Gapic::Operation]
202
222
  #
203
223
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
224
+ #
225
+ # @example Basic example
226
+ # require "google/longrunning"
227
+ #
228
+ # # Create a client object. The client can be reused for multiple calls.
229
+ # client = Google::Longrunning::Operations::Rest::Client.new
230
+ #
231
+ # # Create a request. To set request fields, pass in keyword arguments.
232
+ # request = Google::Longrunning::GetOperationRequest.new
233
+ #
234
+ # # Call the get_operation method.
235
+ # result = client.get_operation request
236
+ #
237
+ # # The returned object is of type Gapic::Operation. You can use it to
238
+ # # check the status of an operation, cancel it, or wait for results.
239
+ # # Here is how to wait for a response.
240
+ # result.wait_until_done! timeout: 60
241
+ # if result.response?
242
+ # p result.response
243
+ # else
244
+ # puts "No response received."
245
+ # end
246
+ #
204
247
  def get_operation request, options = nil
205
248
  raise ::ArgumentError, "request must be provided" if request.nil?
206
249
 
@@ -267,6 +310,22 @@ module Google
267
310
  # @return [::Google::Protobuf::Empty]
268
311
  #
269
312
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
313
+ #
314
+ # @example Basic example
315
+ # require "google/longrunning"
316
+ #
317
+ # # Create a client object. The client can be reused for multiple calls.
318
+ # client = Google::Longrunning::Operations::Rest::Client.new
319
+ #
320
+ # # Create a request. To set request fields, pass in keyword arguments.
321
+ # request = Google::Longrunning::DeleteOperationRequest.new
322
+ #
323
+ # # Call the delete_operation method.
324
+ # result = client.delete_operation request
325
+ #
326
+ # # The returned object is of type Google::Protobuf::Empty.
327
+ # p result
328
+ #
270
329
  def delete_operation request, options = nil
271
330
  raise ::ArgumentError, "request must be provided" if request.nil?
272
331
 
@@ -338,6 +397,22 @@ module Google
338
397
  # @return [::Google::Protobuf::Empty]
339
398
  #
340
399
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
400
+ #
401
+ # @example Basic example
402
+ # require "google/longrunning"
403
+ #
404
+ # # Create a client object. The client can be reused for multiple calls.
405
+ # client = Google::Longrunning::Operations::Rest::Client.new
406
+ #
407
+ # # Create a request. To set request fields, pass in keyword arguments.
408
+ # request = Google::Longrunning::CancelOperationRequest.new
409
+ #
410
+ # # Call the cancel_operation method.
411
+ # result = client.cancel_operation request
412
+ #
413
+ # # The returned object is of type Google::Protobuf::Empty.
414
+ # p result
415
+ #
341
416
  def cancel_operation request, options = nil
342
417
  raise ::ArgumentError, "request must be provided" if request.nil?
343
418
 
@@ -741,6 +816,20 @@ module Google
741
816
  ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/schemas/[^/]+/?$}, false]
742
817
  ]
743
818
  )
819
+ .with_bindings(
820
+ uri_method: :get,
821
+ uri_template: "/v1/{name}/operations",
822
+ matches: [
823
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/targetSites/?$}, false]
824
+ ]
825
+ )
826
+ .with_bindings(
827
+ uri_method: :get,
828
+ uri_template: "/v1/{name}/operations",
829
+ matches: [
830
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/?$}, false]
831
+ ]
832
+ )
744
833
  .with_bindings(
745
834
  uri_method: :get,
746
835
  uri_template: "/v1/{name}/operations",
@@ -748,6 +837,13 @@ module Google
748
837
  ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/?$}, false]
749
838
  ]
750
839
  )
840
+ .with_bindings(
841
+ uri_method: :get,
842
+ uri_template: "/v1/{name}/operations",
843
+ matches: [
844
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/engines/[^/]+/?$}, false]
845
+ ]
846
+ )
751
847
  .with_bindings(
752
848
  uri_method: :get,
753
849
  uri_template: "/v1/{name}/operations",
@@ -839,6 +935,27 @@ module Google
839
935
  ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/schemas/[^/]+/operations/[^/]+/?$}, false]
840
936
  ]
841
937
  )
938
+ .with_bindings(
939
+ uri_method: :get,
940
+ uri_template: "/v1/{name}",
941
+ matches: [
942
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/operations/[^/]+/?$}, false]
943
+ ]
944
+ )
945
+ .with_bindings(
946
+ uri_method: :get,
947
+ uri_template: "/v1/{name}",
948
+ matches: [
949
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/targetSites/operations/[^/]+/?$}, false]
950
+ ]
951
+ )
952
+ .with_bindings(
953
+ uri_method: :get,
954
+ uri_template: "/v1/{name}",
955
+ matches: [
956
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/engines/[^/]+/operations/[^/]+/?$}, false]
957
+ ]
958
+ )
842
959
  .with_bindings(
843
960
  uri_method: :get,
844
961
  uri_template: "/v1/{name}",
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/discoveryengine/v1/search_service_pb"
21
+ require "google/cloud/location"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -138,15 +139,29 @@ module Google
138
139
  @quota_project_id = @config.quota_project
139
140
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
140
141
 
142
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
143
+ config.credentials = credentials
144
+ config.quota_project = @quota_project_id
145
+ config.endpoint = @config.endpoint
146
+ end
147
+
141
148
  @search_service_stub = ::Gapic::ServiceStub.new(
142
149
  ::Google::Cloud::DiscoveryEngine::V1::SearchService::Stub,
143
150
  credentials: credentials,
144
151
  endpoint: @config.endpoint,
145
152
  channel_args: @config.channel_args,
146
- interceptors: @config.interceptors
153
+ interceptors: @config.interceptors,
154
+ channel_pool_config: @config.channel_pool
147
155
  )
148
156
  end
149
157
 
158
+ ##
159
+ # Get the associated client for mix-in of the Locations.
160
+ #
161
+ # @return [Google::Cloud::Location::Locations::Client]
162
+ #
163
+ attr_reader :location_client
164
+
150
165
  # Service calls
151
166
 
152
167
  ##
@@ -162,7 +177,7 @@ module Google
162
177
  # @param options [::Gapic::CallOptions, ::Hash]
163
178
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
164
179
  #
165
- # @overload search(serving_config: nil, branch: nil, query: nil, page_size: nil, page_token: nil, offset: nil, user_info: nil, params: nil, query_expansion_spec: nil, spell_correction_spec: nil, user_pseudo_id: nil, content_search_spec: nil, safe_search: nil, user_labels: nil)
180
+ # @overload search(serving_config: nil, branch: nil, query: nil, image_query: nil, page_size: nil, page_token: nil, offset: nil, filter: nil, order_by: nil, user_info: 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, safe_search: nil, user_labels: nil)
166
181
  # Pass arguments to `search` via keyword arguments. Note that at
167
182
  # least one keyword argument is required. To specify no parameters, or to keep all
168
183
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -180,10 +195,12 @@ module Google
180
195
  # documents under the default branch.
181
196
  # @param query [::String]
182
197
  # Raw search query.
198
+ # @param image_query [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ImageQuery, ::Hash]
199
+ # Raw image query.
183
200
  # @param page_size [::Integer]
184
201
  # Maximum number of {::Google::Cloud::DiscoveryEngine::V1::Document Document}s to
185
202
  # return. If unspecified, defaults to a reasonable value. The maximum allowed
186
- # value is 100. Values above 100 will be coerced to 100.
203
+ # value is 100. Values above 100 are coerced to 100.
187
204
  #
188
205
  # If this field is negative, an `INVALID_ARGUMENT` is returned.
189
206
  # @param page_token [::String]
@@ -204,10 +221,31 @@ module Google
204
221
  # unset.
205
222
  #
206
223
  # If this field is negative, an `INVALID_ARGUMENT` is returned.
224
+ # @param filter [::String]
225
+ # The filter syntax consists of an expression language for constructing a
226
+ # predicate from one or more fields of the documents being filtered. Filter
227
+ # expression is case-sensitive.
228
+ #
229
+ # If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
230
+ # @param order_by [::String]
231
+ # The order in which documents are returned. Documents can be ordered by
232
+ # a field in an {::Google::Cloud::DiscoveryEngine::V1::Document Document} object.
233
+ # Leave it unset if ordered by relevance. `order_by` expression is
234
+ # case-sensitive.
235
+ #
236
+ # If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
207
237
  # @param user_info [::Google::Cloud::DiscoveryEngine::V1::UserInfo, ::Hash]
208
238
  # Information about the end user.
209
- # Highly recommended for analytics. The user_agent string in UserInfo will
210
- # be used to deduce device_type for analytics.
239
+ # Highly recommended for analytics.
240
+ # {::Google::Cloud::DiscoveryEngine::V1::UserInfo#user_agent UserInfo.user_agent}
241
+ # is used to deduce `device_type` for analytics.
242
+ # @param facet_specs [::Array<::Google::Cloud::DiscoveryEngine::V1::SearchRequest::FacetSpec, ::Hash>]
243
+ # Facet specifications for faceted search. If empty, no facets are returned.
244
+ #
245
+ # A maximum of 100 values are allowed. Otherwise, an `INVALID_ARGUMENT`
246
+ # error is returned.
247
+ # @param boost_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::BoostSpec, ::Hash]
248
+ # Boost specification to boost certain documents.
211
249
  # @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}]
212
250
  # Additional search parameters.
213
251
  #
@@ -220,10 +258,10 @@ module Google
220
258
  # which enables image searching.
221
259
  # @param query_expansion_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::QueryExpansionSpec, ::Hash]
222
260
  # The query expansion specification that specifies the conditions under which
223
- # query expansion will occur.
261
+ # query expansion occurs.
224
262
  # @param spell_correction_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::SpellCorrectionSpec, ::Hash]
225
263
  # The spell correction specification that specifies the mode under
226
- # which spell correction will take effect.
264
+ # which spell correction takes effect.
227
265
  # @param user_pseudo_id [::String]
228
266
  # A unique identifier for tracking visitors. For example, this could be
229
267
  # implemented with an HTTP cookie, which should be able to uniquely identify
@@ -240,11 +278,10 @@ module Google
240
278
  # The field must be a UTF-8 encoded string with a length limit of 128
241
279
  # characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
242
280
  # @param content_search_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ContentSearchSpec, ::Hash]
243
- # The content search spec that configs the desired behavior of content
244
- # search.
281
+ # A specification for configuring the behavior of content search.
245
282
  # @param safe_search [::Boolean]
246
283
  # Whether to turn on safe search. This is only supported for
247
- # [ContentConfig.PUBLIC_WEBSITE][].
284
+ # website search.
248
285
  # @param user_labels [::Hash{::String => ::String}]
249
286
  # The user labels applied to a resource must meet the following requirements:
250
287
  #
@@ -452,6 +489,14 @@ module Google
452
489
  end
453
490
  end
454
491
 
492
+ ##
493
+ # Configuration for the channel pool
494
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
495
+ #
496
+ def channel_pool
497
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
498
+ end
499
+
455
500
  ##
456
501
  # Configuration RPC class for the SearchService API.
457
502
  #
@@ -19,6 +19,7 @@
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/discoveryengine/v1/search_service_pb"
21
21
  require "google/cloud/discovery_engine/v1/search_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
22
23
 
23
24
  module Google
24
25
  module Cloud
@@ -135,9 +136,22 @@ module Google
135
136
  @quota_project_id = @config.quota_project
136
137
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
137
138
 
139
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
140
+ config.credentials = credentials
141
+ config.quota_project = @quota_project_id
142
+ config.endpoint = @config.endpoint
143
+ end
144
+
138
145
  @search_service_stub = ::Google::Cloud::DiscoveryEngine::V1::SearchService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
139
146
  end
140
147
 
148
+ ##
149
+ # Get the associated client for mix-in of the Locations.
150
+ #
151
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
152
+ #
153
+ attr_reader :location_client
154
+
141
155
  # Service calls
142
156
 
143
157
  ##
@@ -153,7 +167,7 @@ module Google
153
167
  # @param options [::Gapic::CallOptions, ::Hash]
154
168
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
155
169
  #
156
- # @overload search(serving_config: nil, branch: nil, query: nil, page_size: nil, page_token: nil, offset: nil, user_info: nil, params: nil, query_expansion_spec: nil, spell_correction_spec: nil, user_pseudo_id: nil, content_search_spec: nil, safe_search: nil, user_labels: nil)
170
+ # @overload search(serving_config: nil, branch: nil, query: nil, image_query: nil, page_size: nil, page_token: nil, offset: nil, filter: nil, order_by: nil, user_info: 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, safe_search: nil, user_labels: nil)
157
171
  # Pass arguments to `search` via keyword arguments. Note that at
158
172
  # least one keyword argument is required. To specify no parameters, or to keep all
159
173
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -171,10 +185,12 @@ module Google
171
185
  # documents under the default branch.
172
186
  # @param query [::String]
173
187
  # Raw search query.
188
+ # @param image_query [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ImageQuery, ::Hash]
189
+ # Raw image query.
174
190
  # @param page_size [::Integer]
175
191
  # Maximum number of {::Google::Cloud::DiscoveryEngine::V1::Document Document}s to
176
192
  # return. If unspecified, defaults to a reasonable value. The maximum allowed
177
- # value is 100. Values above 100 will be coerced to 100.
193
+ # value is 100. Values above 100 are coerced to 100.
178
194
  #
179
195
  # If this field is negative, an `INVALID_ARGUMENT` is returned.
180
196
  # @param page_token [::String]
@@ -195,10 +211,31 @@ module Google
195
211
  # unset.
196
212
  #
197
213
  # If this field is negative, an `INVALID_ARGUMENT` is returned.
214
+ # @param filter [::String]
215
+ # The filter syntax consists of an expression language for constructing a
216
+ # predicate from one or more fields of the documents being filtered. Filter
217
+ # expression is case-sensitive.
218
+ #
219
+ # If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
220
+ # @param order_by [::String]
221
+ # The order in which documents are returned. Documents can be ordered by
222
+ # a field in an {::Google::Cloud::DiscoveryEngine::V1::Document Document} object.
223
+ # Leave it unset if ordered by relevance. `order_by` expression is
224
+ # case-sensitive.
225
+ #
226
+ # If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
198
227
  # @param user_info [::Google::Cloud::DiscoveryEngine::V1::UserInfo, ::Hash]
199
228
  # Information about the end user.
200
- # Highly recommended for analytics. The user_agent string in UserInfo will
201
- # be used to deduce device_type for analytics.
229
+ # Highly recommended for analytics.
230
+ # {::Google::Cloud::DiscoveryEngine::V1::UserInfo#user_agent UserInfo.user_agent}
231
+ # is used to deduce `device_type` for analytics.
232
+ # @param facet_specs [::Array<::Google::Cloud::DiscoveryEngine::V1::SearchRequest::FacetSpec, ::Hash>]
233
+ # Facet specifications for faceted search. If empty, no facets are returned.
234
+ #
235
+ # A maximum of 100 values are allowed. Otherwise, an `INVALID_ARGUMENT`
236
+ # error is returned.
237
+ # @param boost_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::BoostSpec, ::Hash]
238
+ # Boost specification to boost certain documents.
202
239
  # @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}]
203
240
  # Additional search parameters.
204
241
  #
@@ -211,10 +248,10 @@ module Google
211
248
  # which enables image searching.
212
249
  # @param query_expansion_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::QueryExpansionSpec, ::Hash]
213
250
  # The query expansion specification that specifies the conditions under which
214
- # query expansion will occur.
251
+ # query expansion occurs.
215
252
  # @param spell_correction_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::SpellCorrectionSpec, ::Hash]
216
253
  # The spell correction specification that specifies the mode under
217
- # which spell correction will take effect.
254
+ # which spell correction takes effect.
218
255
  # @param user_pseudo_id [::String]
219
256
  # A unique identifier for tracking visitors. For example, this could be
220
257
  # implemented with an HTTP cookie, which should be able to uniquely identify
@@ -231,11 +268,10 @@ module Google
231
268
  # The field must be a UTF-8 encoded string with a length limit of 128
232
269
  # characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
233
270
  # @param content_search_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ContentSearchSpec, ::Hash]
234
- # The content search spec that configs the desired behavior of content
235
- # search.
271
+ # A specification for configuring the behavior of content search.
236
272
  # @param safe_search [::Boolean]
237
273
  # Whether to turn on safe search. This is only supported for
238
- # [ContentConfig.PUBLIC_WEBSITE][].
274
+ # website search.
239
275
  # @param user_labels [::Hash{::String => ::String}]
240
276
  # The user labels applied to a resource must meet the following requirements:
241
277
  #
@@ -255,12 +291,32 @@ module Google
255
291
  # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
256
292
  # for more details.
257
293
  # @yield [result, operation] Access the result along with the TransportOperation object
258
- # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult>]
294
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::SearchResponse]
259
295
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
260
296
  #
261
- # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult>]
297
+ # @return [::Google::Cloud::DiscoveryEngine::V1::SearchResponse]
262
298
  #
263
299
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
300
+ #
301
+ # @example Basic example
302
+ # require "google/cloud/discovery_engine/v1"
303
+ #
304
+ # # Create a client object. The client can be reused for multiple calls.
305
+ # client = Google::Cloud::DiscoveryEngine::V1::SearchService::Rest::Client.new
306
+ #
307
+ # # Create a request. To set request fields, pass in keyword arguments.
308
+ # request = Google::Cloud::DiscoveryEngine::V1::SearchRequest.new
309
+ #
310
+ # # Call the search method.
311
+ # result = client.search request
312
+ #
313
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
314
+ # # over elements, and API calls will be issued to fetch pages as needed.
315
+ # result.each do |item|
316
+ # # Each element is of type ::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult.
317
+ # p item
318
+ # end
319
+ #
264
320
  def search request, options = nil
265
321
  raise ::ArgumentError, "request must be provided" if request.nil?
266
322
 
@@ -289,7 +345,6 @@ module Google
289
345
  retry_policy: @config.retry_policy
290
346
 
291
347
  @search_service_stub.search request, options do |result, operation|
292
- result = ::Gapic::Rest::PagedEnumerable.new @search_service_stub, :search, "results", request, result, options
293
348
  yield result, operation if block_given?
294
349
  return result
295
350
  end