Discovery Engine V1 API - Class Google::Cloud::DiscoveryEngine::V1::CompletionService::Rest::Client (v1.4.0)

Reference documentation and code samples for the Discovery Engine V1 API class Google::Cloud::DiscoveryEngine::V1::CompletionService::Rest::Client.

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

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all CompletionService clients
::Google::Cloud::DiscoveryEngine::V1::CompletionService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#complete_query

def complete_query(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1::CompleteQueryResponse
def complete_query(data_store: nil, query: nil, query_model: nil, user_pseudo_id: nil, include_tail_suggestions: nil) -> ::Google::Cloud::DiscoveryEngine::V1::CompleteQueryResponse

Completes the specified user input with keyword suggestions.

Overloads
def complete_query(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1::CompleteQueryResponse
Pass arguments to complete_query via a request object, either of type Google::Cloud::DiscoveryEngine::V1::CompleteQueryRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1::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::V1::CompleteQueryResponse
Pass arguments to 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).
Parameters
  • 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.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/discovery_engine/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1::CompletionService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1::CompleteQueryRequest.new

# Call the complete_query method.
result = client.complete_query request

# The returned object is of type Google::Cloud::DiscoveryEngine::V1::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.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#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::V1::CompletionSuggestion CompletionSuggestion}s for a DataStore.

Overloads
def import_completion_suggestions(request, options = nil) -> ::Gapic::Operation
Pass arguments to import_completion_suggestions via a request object, either of type ImportCompletionSuggestionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1::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
Pass arguments to 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).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/discovery_engine/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1::CompletionService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1::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.

Overloads
def import_suggestion_deny_list_entries(request, options = nil) -> ::Gapic::Operation
Pass arguments to import_suggestion_deny_list_entries via a request object, either of type ImportSuggestionDenyListEntriesRequest or an equivalent Hash.
Parameters
def import_suggestion_deny_list_entries(inline_source: nil, gcs_source: nil, parent: nil) -> ::Gapic::Operation
Pass arguments to 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).
Parameters
  • inline_source (::Google::Cloud::DiscoveryEngine::V1::ImportSuggestionDenyListEntriesRequest::InlineSource, ::Hash) — The Inline source for the input content for suggestion deny list entries.
  • gcs_source (::Google::Cloud::DiscoveryEngine::V1::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/.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/discovery_engine/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1::CompletionService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1::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 REST client object.

Yields
  • (config) — Configure the CompletionService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::DiscoveryEngine::V1::CompletionService::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::DiscoveryEngine::V1::CompletionService::Rest::Client.new do |config|
  config.timeout = 10.0
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Rest::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Rest::Client)

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#operations_client

def operations_client() -> ::Google::Cloud::DiscoveryEngine::V1::CompletionService::Rest::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::V1::CompletionSuggestion CompletionSuggestion}s for a DataStore.

Overloads
def purge_completion_suggestions(request, options = nil) -> ::Gapic::Operation
Pass arguments to purge_completion_suggestions via a request object, either of type PurgeCompletionSuggestionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1::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
Pass arguments to 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).
Parameter
  • parent (::String) — Required. The parent data store resource name for which to purge completion suggestions. Follows pattern projects//locations//collections//dataStores/.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/discovery_engine/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1::CompletionService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1::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.

Overloads
def purge_suggestion_deny_list_entries(request, options = nil) -> ::Gapic::Operation
Pass arguments to purge_suggestion_deny_list_entries via a request object, either of type PurgeSuggestionDenyListEntriesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1::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
Pass arguments to 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).
Parameter
  • parent (::String) — Required. The parent data store resource name for which to import denylist entries. Follows pattern projects//locations//collections//dataStores/.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/discovery_engine/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1::CompletionService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1::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

Returns
  • (String)