Discovery Engine V1BETA API - Class Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client (v0.13.0)

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.

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

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

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

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.

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

#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
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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.

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

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

#operations_client

def operations_client() -> ::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Operations

Get the associated client for long-running operations.

#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
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
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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

Returns
  • (String)