google-cloud-discovery_engine-v1 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) 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 +23 -3
  4. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/client.rb +23 -3
  5. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +959 -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 +797 -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 +23 -8
  13. data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +23 -8
  14. data/lib/google/cloud/discovery_engine/v1/document_service/rest/operations.rb +42 -0
  15. data/lib/google/cloud/discovery_engine/v1/rest.rb +2 -1
  16. data/lib/google/cloud/discovery_engine/v1/schema_service/client.rb +14 -0
  17. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/client.rb +14 -0
  18. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/operations.rb +42 -0
  19. data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +45 -9
  20. data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +47 -12
  21. data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +19 -5
  22. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +19 -5
  23. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/operations.rb +42 -0
  24. data/lib/google/cloud/discovery_engine/v1/version.rb +1 -1
  25. data/lib/google/cloud/discovery_engine/v1.rb +2 -1
  26. data/lib/google/cloud/discoveryengine/v1/common_pb.rb +2 -1
  27. data/lib/google/cloud/discoveryengine/v1/completion_service_pb.rb +1 -1
  28. data/lib/google/cloud/discoveryengine/v1/conversation_pb.rb +54 -0
  29. data/lib/google/cloud/discoveryengine/v1/conversational_search_service_pb.rb +61 -0
  30. data/lib/google/cloud/discoveryengine/v1/conversational_search_service_services_pb.rb +67 -0
  31. data/lib/google/cloud/discoveryengine/v1/import_config_pb.rb +1 -1
  32. data/lib/google/cloud/discoveryengine/v1/search_service_pb.rb +13 -1
  33. data/lib/google/cloud/discoveryengine/v1/user_event_pb.rb +1 -1
  34. data/lib/google/cloud/discoveryengine/v1/user_event_service_services_pb.rb +1 -1
  35. data/proto_docs/google/api/field_behavior.rb +14 -0
  36. data/proto_docs/google/cloud/discoveryengine/v1/common.rb +19 -2
  37. data/proto_docs/google/cloud/discoveryengine/v1/completion_service.rb +15 -2
  38. data/proto_docs/google/cloud/discoveryengine/v1/conversation.rb +113 -0
  39. data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +206 -0
  40. data/proto_docs/google/cloud/discoveryengine/v1/document.rb +8 -5
  41. data/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +4 -3
  42. data/proto_docs/google/cloud/discoveryengine/v1/import_config.rb +23 -19
  43. data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +455 -19
  44. data/proto_docs/google/cloud/discoveryengine/v1/user_event.rb +44 -32
  45. data/proto_docs/google/cloud/discoveryengine/v1/user_event_service.rb +1 -1
  46. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  47. metadata +36 -3
@@ -19,6 +19,7 @@
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/discoveryengine/v1/document_service_pb"
21
21
  require "google/cloud/discovery_engine/v1/document_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
22
23
 
23
24
  module Google
24
25
  module Cloud
@@ -147,6 +148,12 @@ module Google
147
148
  config.endpoint = @config.endpoint
148
149
  end
149
150
 
151
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
152
+ config.credentials = credentials
153
+ config.quota_project = @quota_project_id
154
+ config.endpoint = @config.endpoint
155
+ end
156
+
150
157
  @document_service_stub = ::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
151
158
  end
152
159
 
@@ -157,6 +164,13 @@ module Google
157
164
  #
158
165
  attr_reader :operations_client
159
166
 
167
+ ##
168
+ # Get the associated client for mix-in of the Locations.
169
+ #
170
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
171
+ #
172
+ attr_reader :location_client
173
+
160
174
  # Service calls
161
175
 
162
176
  ##
@@ -254,9 +268,10 @@ module Google
254
268
  # Use `default_branch` as the branch ID, to list documents under the default
255
269
  # branch.
256
270
  #
257
- # If the caller does not have permission to list [Documents][]s under this
258
- # branch, regardless of whether or not this branch exists, a
259
- # `PERMISSION_DENIED` error is returned.
271
+ # If the caller does not have permission to list
272
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s under this branch,
273
+ # regardless of whether or not this branch exists, a `PERMISSION_DENIED`
274
+ # error is returned.
260
275
  # @param page_size [::Integer]
261
276
  # Maximum number of {::Google::Cloud::DiscoveryEngine::V1::Document Document}s to
262
277
  # return. If unspecified, defaults to 100. The maximum allowed value is 1000.
@@ -599,7 +614,7 @@ module Google
599
614
  # `false`, {::Google::Cloud::DiscoveryEngine::V1::Document#id Document.id}s have
600
615
  # to be specified using
601
616
  # {::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest#id_field id_field},
602
- # otherwises, documents without IDs will fail to be imported.
617
+ # otherwise, documents without IDs fail to be imported.
603
618
  #
604
619
  # Only set this field when using
605
620
  # {::Google::Cloud::DiscoveryEngine::V1::GcsSource GcsSource} or
@@ -607,7 +622,7 @@ module Google
607
622
  # {::Google::Cloud::DiscoveryEngine::V1::GcsSource#data_schema GcsSource.data_schema}
608
623
  # or
609
624
  # {::Google::Cloud::DiscoveryEngine::V1::BigQuerySource#data_schema BigQuerySource.data_schema}
610
- # is `custom`. Otherwise, an INVALID_ARGUMENT error is thrown.
625
+ # is `custom` or `csv`. Otherwise, an INVALID_ARGUMENT error is thrown.
611
626
  # @param id_field [::String]
612
627
  # The field in the Cloud Storage and BigQuery sources that indicates the
613
628
  # unique IDs of the documents.
@@ -617,12 +632,12 @@ module Google
617
632
  # For {::Google::Cloud::DiscoveryEngine::V1::BigQuerySource BigQuerySource} it is
618
633
  # the column name of the BigQuery table where the unique ids are stored.
619
634
  #
620
- # The values of the JSON field or the BigQuery column will be used as the
635
+ # The values of the JSON field or the BigQuery column are used as the
621
636
  # {::Google::Cloud::DiscoveryEngine::V1::Document#id Document.id}s. The JSON field
622
637
  # or the BigQuery column must be of string type, and the values must be set
623
638
  # as valid strings conform to [RFC-1034](https://tools.ietf.org/html/rfc1034)
624
- # with 1-63 characters. Otherwise, documents without valid IDs will fail to
625
- # be imported.
639
+ # with 1-63 characters. Otherwise, documents without valid IDs fail to be
640
+ # imported.
626
641
  #
627
642
  # Only set this field when using
628
643
  # {::Google::Cloud::DiscoveryEngine::V1::GcsSource GcsSource} or
@@ -741,6 +741,20 @@ module Google
741
741
  ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/schemas/[^/]+/?$}, false]
742
742
  ]
743
743
  )
744
+ .with_bindings(
745
+ uri_method: :get,
746
+ uri_template: "/v1/{name}/operations",
747
+ matches: [
748
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/targetSites/?$}, false]
749
+ ]
750
+ )
751
+ .with_bindings(
752
+ uri_method: :get,
753
+ uri_template: "/v1/{name}/operations",
754
+ matches: [
755
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/?$}, false]
756
+ ]
757
+ )
744
758
  .with_bindings(
745
759
  uri_method: :get,
746
760
  uri_template: "/v1/{name}/operations",
@@ -748,6 +762,13 @@ module Google
748
762
  ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/?$}, false]
749
763
  ]
750
764
  )
765
+ .with_bindings(
766
+ uri_method: :get,
767
+ uri_template: "/v1/{name}/operations",
768
+ matches: [
769
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/engines/[^/]+/?$}, false]
770
+ ]
771
+ )
751
772
  .with_bindings(
752
773
  uri_method: :get,
753
774
  uri_template: "/v1/{name}/operations",
@@ -839,6 +860,27 @@ module Google
839
860
  ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/schemas/[^/]+/operations/[^/]+/?$}, false]
840
861
  ]
841
862
  )
863
+ .with_bindings(
864
+ uri_method: :get,
865
+ uri_template: "/v1/{name}",
866
+ matches: [
867
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/operations/[^/]+/?$}, false]
868
+ ]
869
+ )
870
+ .with_bindings(
871
+ uri_method: :get,
872
+ uri_template: "/v1/{name}",
873
+ matches: [
874
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/targetSites/operations/[^/]+/?$}, false]
875
+ ]
876
+ )
877
+ .with_bindings(
878
+ uri_method: :get,
879
+ uri_template: "/v1/{name}",
880
+ matches: [
881
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/engines/[^/]+/operations/[^/]+/?$}, false]
882
+ ]
883
+ )
842
884
  .with_bindings(
843
885
  uri_method: :get,
844
886
  uri_template: "/v1/{name}",
@@ -17,9 +17,10 @@
17
17
  # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
18
 
19
19
  require "google/cloud/discovery_engine/v1/completion_service/rest"
20
+ require "google/cloud/discovery_engine/v1/search_service/rest"
21
+ require "google/cloud/discovery_engine/v1/conversational_search_service/rest"
20
22
  require "google/cloud/discovery_engine/v1/document_service/rest"
21
23
  require "google/cloud/discovery_engine/v1/schema_service/rest"
22
- require "google/cloud/discovery_engine/v1/search_service/rest"
23
24
  require "google/cloud/discovery_engine/v1/user_event_service/rest"
24
25
  require "google/cloud/discovery_engine/v1/version"
25
26
 
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/discoveryengine/v1/schema_service_pb"
21
+ require "google/cloud/location"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -144,6 +145,12 @@ module Google
144
145
  config.endpoint = @config.endpoint
145
146
  end
146
147
 
148
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
149
+ config.credentials = credentials
150
+ config.quota_project = @quota_project_id
151
+ config.endpoint = @config.endpoint
152
+ end
153
+
147
154
  @schema_service_stub = ::Gapic::ServiceStub.new(
148
155
  ::Google::Cloud::DiscoveryEngine::V1::SchemaService::Stub,
149
156
  credentials: credentials,
@@ -160,6 +167,13 @@ module Google
160
167
  #
161
168
  attr_reader :operations_client
162
169
 
170
+ ##
171
+ # Get the associated client for mix-in of the Locations.
172
+ #
173
+ # @return [Google::Cloud::Location::Locations::Client]
174
+ #
175
+ attr_reader :location_client
176
+
163
177
  # Service calls
164
178
 
165
179
  ##
@@ -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
  ##
@@ -741,6 +741,20 @@ module Google
741
741
  ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/schemas/[^/]+/?$}, false]
742
742
  ]
743
743
  )
744
+ .with_bindings(
745
+ uri_method: :get,
746
+ uri_template: "/v1/{name}/operations",
747
+ matches: [
748
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/targetSites/?$}, false]
749
+ ]
750
+ )
751
+ .with_bindings(
752
+ uri_method: :get,
753
+ uri_template: "/v1/{name}/operations",
754
+ matches: [
755
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/?$}, false]
756
+ ]
757
+ )
744
758
  .with_bindings(
745
759
  uri_method: :get,
746
760
  uri_template: "/v1/{name}/operations",
@@ -748,6 +762,13 @@ module Google
748
762
  ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/?$}, false]
749
763
  ]
750
764
  )
765
+ .with_bindings(
766
+ uri_method: :get,
767
+ uri_template: "/v1/{name}/operations",
768
+ matches: [
769
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/engines/[^/]+/?$}, false]
770
+ ]
771
+ )
751
772
  .with_bindings(
752
773
  uri_method: :get,
753
774
  uri_template: "/v1/{name}/operations",
@@ -839,6 +860,27 @@ module Google
839
860
  ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/schemas/[^/]+/operations/[^/]+/?$}, false]
840
861
  ]
841
862
  )
863
+ .with_bindings(
864
+ uri_method: :get,
865
+ uri_template: "/v1/{name}",
866
+ matches: [
867
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/operations/[^/]+/?$}, false]
868
+ ]
869
+ )
870
+ .with_bindings(
871
+ uri_method: :get,
872
+ uri_template: "/v1/{name}",
873
+ matches: [
874
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/siteSearchEngine/targetSites/operations/[^/]+/?$}, false]
875
+ ]
876
+ )
877
+ .with_bindings(
878
+ uri_method: :get,
879
+ uri_template: "/v1/{name}",
880
+ matches: [
881
+ ["name", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/engines/[^/]+/operations/[^/]+/?$}, false]
882
+ ]
883
+ )
842
884
  .with_bindings(
843
885
  uri_method: :get,
844
886
  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,6 +139,12 @@ 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,
@@ -147,6 +154,13 @@ module Google
147
154
  )
148
155
  end
149
156
 
157
+ ##
158
+ # Get the associated client for mix-in of the Locations.
159
+ #
160
+ # @return [Google::Cloud::Location::Locations::Client]
161
+ #
162
+ attr_reader :location_client
163
+
150
164
  # Service calls
151
165
 
152
166
  ##
@@ -162,7 +176,7 @@ module Google
162
176
  # @param options [::Gapic::CallOptions, ::Hash]
163
177
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
164
178
  #
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)
179
+ # @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
180
  # Pass arguments to `search` via keyword arguments. Note that at
167
181
  # least one keyword argument is required. To specify no parameters, or to keep all
168
182
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -180,10 +194,12 @@ module Google
180
194
  # documents under the default branch.
181
195
  # @param query [::String]
182
196
  # Raw search query.
197
+ # @param image_query [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ImageQuery, ::Hash]
198
+ # Raw image query.
183
199
  # @param page_size [::Integer]
184
200
  # Maximum number of {::Google::Cloud::DiscoveryEngine::V1::Document Document}s to
185
201
  # return. If unspecified, defaults to a reasonable value. The maximum allowed
186
- # value is 100. Values above 100 will be coerced to 100.
202
+ # value is 100. Values above 100 are coerced to 100.
187
203
  #
188
204
  # If this field is negative, an `INVALID_ARGUMENT` is returned.
189
205
  # @param page_token [::String]
@@ -204,10 +220,31 @@ module Google
204
220
  # unset.
205
221
  #
206
222
  # If this field is negative, an `INVALID_ARGUMENT` is returned.
223
+ # @param filter [::String]
224
+ # The filter syntax consists of an expression language for constructing a
225
+ # predicate from one or more fields of the documents being filtered. Filter
226
+ # expression is case-sensitive.
227
+ #
228
+ # If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
229
+ # @param order_by [::String]
230
+ # The order in which documents are returned. Documents can be ordered by
231
+ # a field in an {::Google::Cloud::DiscoveryEngine::V1::Document Document} object.
232
+ # Leave it unset if ordered by relevance. `order_by` expression is
233
+ # case-sensitive.
234
+ #
235
+ # If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
207
236
  # @param user_info [::Google::Cloud::DiscoveryEngine::V1::UserInfo, ::Hash]
208
237
  # 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.
238
+ # Highly recommended for analytics.
239
+ # {::Google::Cloud::DiscoveryEngine::V1::UserInfo#user_agent UserInfo.user_agent}
240
+ # is used to deduce `device_type` for analytics.
241
+ # @param facet_specs [::Array<::Google::Cloud::DiscoveryEngine::V1::SearchRequest::FacetSpec, ::Hash>]
242
+ # Facet specifications for faceted search. If empty, no facets are returned.
243
+ #
244
+ # A maximum of 100 values are allowed. Otherwise, an `INVALID_ARGUMENT`
245
+ # error is returned.
246
+ # @param boost_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::BoostSpec, ::Hash]
247
+ # Boost specification to boost certain documents.
211
248
  # @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}]
212
249
  # Additional search parameters.
213
250
  #
@@ -220,10 +257,10 @@ module Google
220
257
  # which enables image searching.
221
258
  # @param query_expansion_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::QueryExpansionSpec, ::Hash]
222
259
  # The query expansion specification that specifies the conditions under which
223
- # query expansion will occur.
260
+ # query expansion occurs.
224
261
  # @param spell_correction_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::SpellCorrectionSpec, ::Hash]
225
262
  # The spell correction specification that specifies the mode under
226
- # which spell correction will take effect.
263
+ # which spell correction takes effect.
227
264
  # @param user_pseudo_id [::String]
228
265
  # A unique identifier for tracking visitors. For example, this could be
229
266
  # implemented with an HTTP cookie, which should be able to uniquely identify
@@ -240,11 +277,10 @@ module Google
240
277
  # The field must be a UTF-8 encoded string with a length limit of 128
241
278
  # characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
242
279
  # @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.
280
+ # A specification for configuring the behavior of content search.
245
281
  # @param safe_search [::Boolean]
246
282
  # Whether to turn on safe search. This is only supported for
247
- # [ContentConfig.PUBLIC_WEBSITE][].
283
+ # website search.
248
284
  # @param user_labels [::Hash{::String => ::String}]
249
285
  # The user labels applied to a resource must meet the following requirements:
250
286
  #
@@ -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,10 +291,10 @@ 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.
264
300
  def search request, options = nil
@@ -289,7 +325,6 @@ module Google
289
325
  retry_policy: @config.retry_policy
290
326
 
291
327
  @search_service_stub.search request, options do |result, operation|
292
- result = ::Gapic::Rest::PagedEnumerable.new @search_service_stub, :search, "results", request, result, options
293
328
  yield result, operation if block_given?
294
329
  return result
295
330
  end
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/discoveryengine/v1/user_event_service_pb"
21
+ require "google/cloud/location"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -149,6 +150,12 @@ module Google
149
150
  config.endpoint = @config.endpoint
150
151
  end
151
152
 
153
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
154
+ config.credentials = credentials
155
+ config.quota_project = @quota_project_id
156
+ config.endpoint = @config.endpoint
157
+ end
158
+
152
159
  @user_event_service_stub = ::Gapic::ServiceStub.new(
153
160
  ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Stub,
154
161
  credentials: credentials,
@@ -165,6 +172,13 @@ module Google
165
172
  #
166
173
  attr_reader :operations_client
167
174
 
175
+ ##
176
+ # Get the associated client for mix-in of the Locations.
177
+ #
178
+ # @return [Google::Cloud::Location::Locations::Client]
179
+ #
180
+ attr_reader :location_client
181
+
168
182
  # Service calls
169
183
 
170
184
  ##
@@ -257,7 +271,7 @@ module Google
257
271
 
258
272
  ##
259
273
  # Writes a single user event from the browser. This uses a GET request to
260
- # due to browser restriction of POST-ing to a 3rd party domain.
274
+ # due to browser restriction of POST-ing to a third-party domain.
261
275
  #
262
276
  # This method is used only by the Discovery Engine API JavaScript pixel and
263
277
  # Google Tag Manager. Users should not call this method directly.
@@ -286,7 +300,7 @@ module Google
286
300
  # @param uri [::String]
287
301
  # The URL including cgi-parameters but excluding the hash fragment with a
288
302
  # length limit of 5,000 characters. This is often more useful than the
289
- # referer URL, because many browsers only send the domain for 3rd party
303
+ # referer URL, because many browsers only send the domain for third-party
290
304
  # requests.
291
305
  # @param ets [::Integer]
292
306
  # The event timestamp in milliseconds. This prevents browser caching of
@@ -382,11 +396,11 @@ module Google
382
396
  # the default parameter values, pass an empty Hash as a request object (see above).
383
397
  #
384
398
  # @param inline_source [::Google::Cloud::DiscoveryEngine::V1::ImportUserEventsRequest::InlineSource, ::Hash]
385
- # Required. The Inline source for the input content for UserEvents.
399
+ # The Inline source for the input content for UserEvents.
386
400
  # @param gcs_source [::Google::Cloud::DiscoveryEngine::V1::GcsSource, ::Hash]
387
- # Required. Cloud Storage location for the input content.
401
+ # Cloud Storage location for the input content.
388
402
  # @param bigquery_source [::Google::Cloud::DiscoveryEngine::V1::BigQuerySource, ::Hash]
389
- # Required. BigQuery input source.
403
+ # BigQuery input source.
390
404
  # @param parent [::String]
391
405
  # Required. Parent DataStore resource name, of the form
392
406
  # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`