Reference documentation and code samples for the Discovery Engine V1BETA API class Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.
Client for the CompletionService service.
Service for Auto-Completion.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the CompletionService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all CompletionService clients ::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.configure do |config| config.timeout = 10.0 end
#advanced_complete_query
def advanced_complete_query(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryResponse
def advanced_complete_query(completion_config: nil, query: nil, query_model: nil, user_pseudo_id: nil, user_info: nil, include_tail_suggestions: nil, boost_spec: nil, suggestion_types: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryResponse
Completes the user input with advanced keyword suggestions.
def advanced_complete_query(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryResponse
advanced_complete_query
via a request object, either of type
AdvancedCompleteQueryRequest or an equivalent Hash.
- request (::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def advanced_complete_query(completion_config: nil, query: nil, query_model: nil, user_pseudo_id: nil, user_info: nil, include_tail_suggestions: nil, boost_spec: nil, suggestion_types: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryResponse
advanced_complete_query
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
completion_config (::String) — Required. The completion_config of the parent dataStore or engine resource
name for which the completion is performed, such as
projects/*/locations/global/collections/default_collection/dataStores/*/completionConfig
projects/*/locations/global/collections/default_collection/engines/*/completionConfig
. -
query (::String) — Required. The typeahead input used to fetch suggestions. Maximum length is
128 characters.
The query can not be empty for most of the suggestion types. If it is empty, an
INVALID_ARGUMENT
error is returned. The exception is when the suggestion_types contains only the typeRECENT_SEARCH
, the query can be an empty string. The is called "zero prefix" feature, which returns user's recently searched queries given the empty query. -
query_model (::String) —
Specifies the autocomplete data model. This overrides any model specified in the Configuration > Autocomplete section of the Cloud console. Currently supported values:
document
- Using suggestions generated from user-imported documents.search-history
- Using suggestions generated from the past history of SearchService.Search API calls. Do not use it when there is no traffic for Search API.user-event
- Using suggestions generated from user-imported search events.document-completable
- Using suggestions taken directly from user-imported document fields marked as completable.
Default values:
document
is the default model for regular dataStores.search-history
is the default model for site search dataStores.
-
user_pseudo_id (::String) — A unique identifier for tracking visitors. For example, this could be
implemented with an HTTP cookie, which should be able to uniquely identify
a visitor on a single device. This unique identifier should not change if
the visitor logs in or out of the website.
This field should NOT have a fixed value such as
unknown_visitor
.This should be the same identifier as UserEvent.user_pseudo_id and SearchRequest.user_pseudo_id.
The field must be a UTF-8 encoded string with a length limit of 128
-
user_info (::Google::Cloud::DiscoveryEngine::V1beta::UserInfo, ::Hash) — Optional. Information about the end user.
This should be the same identifier information as UserEvent.user_info and SearchRequest.user_info.
- include_tail_suggestions (::Boolean) — Indicates if tail suggestions should be returned if there are no suggestions that match the full query. Even if set to true, if there are suggestions that match the full query, those are returned and no tail suggestions are returned.
- boost_spec (::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryRequest::BoostSpec, ::Hash) — Optional. Specification to boost suggestions matching the condition.
- suggestion_types (::Array<::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryRequest::SuggestionType>) — Optional. Suggestion types to return. If empty or unspecified, query suggestions are returned. Only one suggestion type is supported at the moment.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/discovery_engine/v1beta" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryRequest.new # Call the advanced_complete_query method. result = client.advanced_complete_query request # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryResponse. p result
#complete_query
def complete_query(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryResponse
def complete_query(data_store: nil, query: nil, query_model: nil, user_pseudo_id: nil, include_tail_suggestions: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryResponse
Completes the specified user input with keyword suggestions.
def complete_query(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryResponse
complete_query
via a request object, either of type
Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryRequest or an equivalent Hash.
- request (::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def complete_query(data_store: nil, query: nil, query_model: nil, user_pseudo_id: nil, include_tail_suggestions: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryResponse
complete_query
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
data_store (::String) — Required. The parent data store resource name for which the completion is
performed, such as
projects/*/locations/global/collections/default_collection/dataStores/default_data_store
. - query (::String) — Required. The typeahead input used to fetch suggestions. Maximum length is 128 characters.
-
query_model (::String) —
Specifies the autocomplete data model. This overrides any model specified in the Configuration > Autocomplete section of the Cloud console. Currently supported values:
document
- Using suggestions generated from user-imported documents.search-history
- Using suggestions generated from the past history of SearchService.Search API calls. Do not use it when there is no traffic for Search API.user-event
- Using suggestions generated from user-imported search events.document-completable
- Using suggestions taken directly from user-imported document fields marked as completable.
Default values:
document
is the default model for regular dataStores.search-history
is the default model for site search dataStores.
-
user_pseudo_id (::String) — A unique identifier for tracking visitors. For example, this could be
implemented with an HTTP cookie, which should be able to uniquely identify
a visitor on a single device. This unique identifier should not change if
the visitor logs in or out of the website.
This field should NOT have a fixed value such as
unknown_visitor
.This should be the same identifier as UserEvent.user_pseudo_id and SearchRequest.user_pseudo_id.
The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an
INVALID_ARGUMENT
error is returned. - include_tail_suggestions (::Boolean) — Indicates if tail suggestions should be returned if there are no suggestions that match the full query. Even if set to true, if there are suggestions that match the full query, those are returned and no tail suggestions are returned.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/discovery_engine/v1beta" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryRequest.new # Call the complete_query method. result = client.complete_query request # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryResponse. p result
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the CompletionService Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#import_completion_suggestions
def import_completion_suggestions(request, options = nil) -> ::Gapic::Operation
def import_completion_suggestions(inline_source: nil, gcs_source: nil, bigquery_source: nil, parent: nil, error_config: nil) -> ::Gapic::Operation
Imports {::Google::Cloud::DiscoveryEngine::V1beta::CompletionSuggestion CompletionSuggestion}s for a DataStore.
def import_completion_suggestions(request, options = nil) -> ::Gapic::Operation
import_completion_suggestions
via a request object, either of type
ImportCompletionSuggestionsRequest or an equivalent Hash.
- request (::Google::Cloud::DiscoveryEngine::V1beta::ImportCompletionSuggestionsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def import_completion_suggestions(inline_source: nil, gcs_source: nil, bigquery_source: nil, parent: nil, error_config: nil) -> ::Gapic::Operation
import_completion_suggestions
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- inline_source (::Google::Cloud::DiscoveryEngine::V1beta::ImportCompletionSuggestionsRequest::InlineSource, ::Hash) — The Inline source for suggestion entries.
- gcs_source (::Google::Cloud::DiscoveryEngine::V1beta::GcsSource, ::Hash) — Cloud Storage location for the input content.
- bigquery_source (::Google::Cloud::DiscoveryEngine::V1beta::BigQuerySource, ::Hash) — BigQuery input source.
-
parent (::String) — Required. The parent data store resource name for which to import customer
autocomplete suggestions.
Follows pattern
projects/*/locations/*/collections/*/dataStores/*
- error_config (::Google::Cloud::DiscoveryEngine::V1beta::ImportErrorConfig, ::Hash) — The desired location of errors incurred during the Import.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/discovery_engine/v1beta" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::DiscoveryEngine::V1beta::ImportCompletionSuggestionsRequest.new # Call the import_completion_suggestions method. result = client.import_completion_suggestions request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#import_suggestion_deny_list_entries
def import_suggestion_deny_list_entries(request, options = nil) -> ::Gapic::Operation
def import_suggestion_deny_list_entries(inline_source: nil, gcs_source: nil, parent: nil) -> ::Gapic::Operation
Imports all SuggestionDenyListEntry for a DataStore.
def import_suggestion_deny_list_entries(request, options = nil) -> ::Gapic::Operation
import_suggestion_deny_list_entries
via a request object, either of type
ImportSuggestionDenyListEntriesRequest or an equivalent Hash.
- request (::Google::Cloud::DiscoveryEngine::V1beta::ImportSuggestionDenyListEntriesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def import_suggestion_deny_list_entries(inline_source: nil, gcs_source: nil, parent: nil) -> ::Gapic::Operation
import_suggestion_deny_list_entries
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- inline_source (::Google::Cloud::DiscoveryEngine::V1beta::ImportSuggestionDenyListEntriesRequest::InlineSource, ::Hash) — The Inline source for the input content for suggestion deny list entries.
-
gcs_source (::Google::Cloud::DiscoveryEngine::V1beta::GcsSource, ::Hash) —
Cloud Storage location for the input content.
Only 1 file can be specified that contains all entries to import. Supported values
gcs_source.schema
for autocomplete suggestion deny list entry imports:suggestion_deny_list
(default): One JSON [SuggestionDenyListEntry] per line.
- parent (::String) — Required. The parent data store resource name for which to import denylist entries. Follows pattern projects//locations//collections//dataStores/.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/discovery_engine/v1beta" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::DiscoveryEngine::V1beta::ImportSuggestionDenyListEntriesRequest.new # Call the import_suggestion_deny_list_entries method. result = client.import_suggestion_deny_list_entries request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#initialize
def initialize() { |config| ... } -> Client
Create a new CompletionService client object.
- (config) — Configure the CompletionService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new # Create a client using a custom configuration client = ::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new do |config| config.timeout = 10.0 end
#location_client
def location_client() -> Google::Cloud::Location::Locations::Client
Get the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Client)
#logger
def logger() -> Logger
The logger used for request/response debug logging.
- (Logger)
#operations_client
def operations_client() -> ::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Operations
Get the associated client for long-running operations.
#purge_completion_suggestions
def purge_completion_suggestions(request, options = nil) -> ::Gapic::Operation
def purge_completion_suggestions(parent: nil) -> ::Gapic::Operation
Permanently deletes all {::Google::Cloud::DiscoveryEngine::V1beta::CompletionSuggestion CompletionSuggestion}s for a DataStore.
def purge_completion_suggestions(request, options = nil) -> ::Gapic::Operation
purge_completion_suggestions
via a request object, either of type
PurgeCompletionSuggestionsRequest or an equivalent Hash.
- request (::Google::Cloud::DiscoveryEngine::V1beta::PurgeCompletionSuggestionsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def purge_completion_suggestions(parent: nil) -> ::Gapic::Operation
purge_completion_suggestions
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- parent (::String) — Required. The parent data store resource name for which to purge completion suggestions. Follows pattern projects//locations//collections//dataStores/.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/discovery_engine/v1beta" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::DiscoveryEngine::V1beta::PurgeCompletionSuggestionsRequest.new # Call the purge_completion_suggestions method. result = client.purge_completion_suggestions request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#purge_suggestion_deny_list_entries
def purge_suggestion_deny_list_entries(request, options = nil) -> ::Gapic::Operation
def purge_suggestion_deny_list_entries(parent: nil) -> ::Gapic::Operation
Permanently deletes all SuggestionDenyListEntry for a DataStore.
def purge_suggestion_deny_list_entries(request, options = nil) -> ::Gapic::Operation
purge_suggestion_deny_list_entries
via a request object, either of type
PurgeSuggestionDenyListEntriesRequest or an equivalent Hash.
- request (::Google::Cloud::DiscoveryEngine::V1beta::PurgeSuggestionDenyListEntriesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def purge_suggestion_deny_list_entries(parent: nil) -> ::Gapic::Operation
purge_suggestion_deny_list_entries
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- parent (::String) — Required. The parent data store resource name for which to import denylist entries. Follows pattern projects//locations//collections//dataStores/.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/discovery_engine/v1beta" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::DiscoveryEngine::V1beta::PurgeSuggestionDenyListEntriesRequest.new # Call the purge_suggestion_deny_list_entries method. result = client.purge_suggestion_deny_list_entries request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#universe_domain
def universe_domain() -> String
The effective universe domain
- (String)