Discovery Engine V1 API - Class Google::Cloud::DiscoveryEngine::V1::CompletionService::Rest::Client (v0.2.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) —

    Selects data model of query suggestions for serving. 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 [IndustryVertical.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.

#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

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