Class CompleteQueryRequest.Builder (2.46.0)

public static final class CompleteQueryRequest.Builder extends GeneratedMessageV3.Builder<CompleteQueryRequest.Builder> implements CompleteQueryRequestOrBuilder

Autocomplete parameters.

Protobuf type google.cloud.retail.v2.CompleteQueryRequest

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addAllLanguageCodes(Iterable<String> values)

public CompleteQueryRequest.Builder addAllLanguageCodes(Iterable<String> values)

Note that this field applies for user-data dataset only. For requests with cloud-retail dataset, setting this field has no effect.

The language filters applied to the output suggestions. If set, it should contain the language of the query. If not set, suggestions are returned without considering language restrictions. This is the BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see Tags for Identifying Languages. The maximum number of language codes is 3.

repeated string language_codes = 3;

Parameter
Name Description
values Iterable<String>

The languageCodes to add.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

addLanguageCodes(String value)

public CompleteQueryRequest.Builder addLanguageCodes(String value)

Note that this field applies for user-data dataset only. For requests with cloud-retail dataset, setting this field has no effect.

The language filters applied to the output suggestions. If set, it should contain the language of the query. If not set, suggestions are returned without considering language restrictions. This is the BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see Tags for Identifying Languages. The maximum number of language codes is 3.

repeated string language_codes = 3;

Parameter
Name Description
value String

The languageCodes to add.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

addLanguageCodesBytes(ByteString value)

public CompleteQueryRequest.Builder addLanguageCodesBytes(ByteString value)

Note that this field applies for user-data dataset only. For requests with cloud-retail dataset, setting this field has no effect.

The language filters applied to the output suggestions. If set, it should contain the language of the query. If not set, suggestions are returned without considering language restrictions. This is the BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see Tags for Identifying Languages. The maximum number of language codes is 3.

repeated string language_codes = 3;

Parameter
Name Description
value ByteString

The bytes of the languageCodes to add.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public CompleteQueryRequest.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
CompleteQueryRequest.Builder
Overrides

build()

public CompleteQueryRequest build()
Returns
Type Description
CompleteQueryRequest

buildPartial()

public CompleteQueryRequest buildPartial()
Returns
Type Description
CompleteQueryRequest

clear()

public CompleteQueryRequest.Builder clear()
Returns
Type Description
CompleteQueryRequest.Builder
Overrides

clearCatalog()

public CompleteQueryRequest.Builder clearCatalog()

Required. Catalog for which the completion is performed.

Full resource name of catalog, such as projects/*/locations/global/catalogs/default_catalog.

string catalog = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

clearDataset()

public CompleteQueryRequest.Builder clearDataset()

Determines which dataset to use for fetching completion. "user-data" will use the imported dataset through CompletionService.ImportCompletionData. "cloud-retail" will use the dataset generated by cloud retail based on user events. If leave empty, it will use the "user-data".

Current supported values:

  • user-data

  • cloud-retail: This option requires enabling auto-learning function first. See guidelines.

string dataset = 6;

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

clearDeviceType()

public CompleteQueryRequest.Builder clearDeviceType()

The device type context for completion suggestions. We recommend that you leave this field empty.

It can apply different suggestions on different device types, e.g. DESKTOP, MOBILE. If it is empty, the suggestions are across all device types.

Supported formats:

  • UNKNOWN_DEVICE_TYPE

  • DESKTOP

  • MOBILE

  • A customized string starts with OTHER_, e.g. OTHER_IPHONE.

string device_type = 4;

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

clearEntity()

public CompleteQueryRequest.Builder clearEntity()

The entity for customers that may run multiple different entities, domains, sites or regions, for example, Google US, Google Ads, Waymo, google.com, youtube.com, etc. If this is set, it should be exactly matched with UserEvent.entity to get per-entity autocomplete results.

string entity = 10;

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public CompleteQueryRequest.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
CompleteQueryRequest.Builder
Overrides

clearLanguageCodes()

public CompleteQueryRequest.Builder clearLanguageCodes()

Note that this field applies for user-data dataset only. For requests with cloud-retail dataset, setting this field has no effect.

The language filters applied to the output suggestions. If set, it should contain the language of the query. If not set, suggestions are returned without considering language restrictions. This is the BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see Tags for Identifying Languages. The maximum number of language codes is 3.

repeated string language_codes = 3;

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

clearMaxSuggestions()

public CompleteQueryRequest.Builder clearMaxSuggestions()

Completion max suggestions. If left unset or set to 0, then will fallback to the configured value CompletionConfig.max_suggestions.

The maximum allowed max suggestions is 20. If it is set higher, it will be capped by 20.

int32 max_suggestions = 5;

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

public CompleteQueryRequest.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
CompleteQueryRequest.Builder
Overrides

clearQuery()

public CompleteQueryRequest.Builder clearQuery()

Required. The query used to generate suggestions.

The maximum number of allowed characters is 255.

string query = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

clearVisitorId()

public CompleteQueryRequest.Builder clearVisitorId()

Required field. 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.

The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

string visitor_id = 7;

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

clone()

public CompleteQueryRequest.Builder clone()
Returns
Type Description
CompleteQueryRequest.Builder
Overrides

getCatalog()

public String getCatalog()

Required. Catalog for which the completion is performed.

Full resource name of catalog, such as projects/*/locations/global/catalogs/default_catalog.

string catalog = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }

Returns
Type Description
String

The catalog.

getCatalogBytes()

public ByteString getCatalogBytes()

Required. Catalog for which the completion is performed.

Full resource name of catalog, such as projects/*/locations/global/catalogs/default_catalog.

string catalog = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }

Returns
Type Description
ByteString

The bytes for catalog.

getDataset()

public String getDataset()

Determines which dataset to use for fetching completion. "user-data" will use the imported dataset through CompletionService.ImportCompletionData. "cloud-retail" will use the dataset generated by cloud retail based on user events. If leave empty, it will use the "user-data".

Current supported values:

  • user-data

  • cloud-retail: This option requires enabling auto-learning function first. See guidelines.

string dataset = 6;

Returns
Type Description
String

The dataset.

getDatasetBytes()

public ByteString getDatasetBytes()

Determines which dataset to use for fetching completion. "user-data" will use the imported dataset through CompletionService.ImportCompletionData. "cloud-retail" will use the dataset generated by cloud retail based on user events. If leave empty, it will use the "user-data".

Current supported values:

  • user-data

  • cloud-retail: This option requires enabling auto-learning function first. See guidelines.

string dataset = 6;

Returns
Type Description
ByteString

The bytes for dataset.

getDefaultInstanceForType()

public CompleteQueryRequest getDefaultInstanceForType()
Returns
Type Description
CompleteQueryRequest

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getDeviceType()

public String getDeviceType()

The device type context for completion suggestions. We recommend that you leave this field empty.

It can apply different suggestions on different device types, e.g. DESKTOP, MOBILE. If it is empty, the suggestions are across all device types.

Supported formats:

  • UNKNOWN_DEVICE_TYPE

  • DESKTOP

  • MOBILE

  • A customized string starts with OTHER_, e.g. OTHER_IPHONE.

string device_type = 4;

Returns
Type Description
String

The deviceType.

getDeviceTypeBytes()

public ByteString getDeviceTypeBytes()

The device type context for completion suggestions. We recommend that you leave this field empty.

It can apply different suggestions on different device types, e.g. DESKTOP, MOBILE. If it is empty, the suggestions are across all device types.

Supported formats:

  • UNKNOWN_DEVICE_TYPE

  • DESKTOP

  • MOBILE

  • A customized string starts with OTHER_, e.g. OTHER_IPHONE.

string device_type = 4;

Returns
Type Description
ByteString

The bytes for deviceType.

getEntity()

public String getEntity()

The entity for customers that may run multiple different entities, domains, sites or regions, for example, Google US, Google Ads, Waymo, google.com, youtube.com, etc. If this is set, it should be exactly matched with UserEvent.entity to get per-entity autocomplete results.

string entity = 10;

Returns
Type Description
String

The entity.

getEntityBytes()

public ByteString getEntityBytes()

The entity for customers that may run multiple different entities, domains, sites or regions, for example, Google US, Google Ads, Waymo, google.com, youtube.com, etc. If this is set, it should be exactly matched with UserEvent.entity to get per-entity autocomplete results.

string entity = 10;

Returns
Type Description
ByteString

The bytes for entity.

getLanguageCodes(int index)

public String getLanguageCodes(int index)

Note that this field applies for user-data dataset only. For requests with cloud-retail dataset, setting this field has no effect.

The language filters applied to the output suggestions. If set, it should contain the language of the query. If not set, suggestions are returned without considering language restrictions. This is the BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see Tags for Identifying Languages. The maximum number of language codes is 3.

repeated string language_codes = 3;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The languageCodes at the given index.

getLanguageCodesBytes(int index)

public ByteString getLanguageCodesBytes(int index)

Note that this field applies for user-data dataset only. For requests with cloud-retail dataset, setting this field has no effect.

The language filters applied to the output suggestions. If set, it should contain the language of the query. If not set, suggestions are returned without considering language restrictions. This is the BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see Tags for Identifying Languages. The maximum number of language codes is 3.

repeated string language_codes = 3;

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the languageCodes at the given index.

getLanguageCodesCount()

public int getLanguageCodesCount()

Note that this field applies for user-data dataset only. For requests with cloud-retail dataset, setting this field has no effect.

The language filters applied to the output suggestions. If set, it should contain the language of the query. If not set, suggestions are returned without considering language restrictions. This is the BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see Tags for Identifying Languages. The maximum number of language codes is 3.

repeated string language_codes = 3;

Returns
Type Description
int

The count of languageCodes.

getLanguageCodesList()

public ProtocolStringList getLanguageCodesList()

Note that this field applies for user-data dataset only. For requests with cloud-retail dataset, setting this field has no effect.

The language filters applied to the output suggestions. If set, it should contain the language of the query. If not set, suggestions are returned without considering language restrictions. This is the BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see Tags for Identifying Languages. The maximum number of language codes is 3.

repeated string language_codes = 3;

Returns
Type Description
ProtocolStringList

A list containing the languageCodes.

getMaxSuggestions()

public int getMaxSuggestions()

Completion max suggestions. If left unset or set to 0, then will fallback to the configured value CompletionConfig.max_suggestions.

The maximum allowed max suggestions is 20. If it is set higher, it will be capped by 20.

int32 max_suggestions = 5;

Returns
Type Description
int

The maxSuggestions.

getQuery()

public String getQuery()

Required. The query used to generate suggestions.

The maximum number of allowed characters is 255.

string query = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
String

The query.

getQueryBytes()

public ByteString getQueryBytes()

Required. The query used to generate suggestions.

The maximum number of allowed characters is 255.

string query = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
ByteString

The bytes for query.

getVisitorId()

public String getVisitorId()

Required field. 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.

The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

string visitor_id = 7;

Returns
Type Description
String

The visitorId.

getVisitorIdBytes()

public ByteString getVisitorIdBytes()

Required field. 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.

The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

string visitor_id = 7;

Returns
Type Description
ByteString

The bytes for visitorId.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(CompleteQueryRequest other)

public CompleteQueryRequest.Builder mergeFrom(CompleteQueryRequest other)
Parameter
Name Description
other CompleteQueryRequest
Returns
Type Description
CompleteQueryRequest.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public CompleteQueryRequest.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
CompleteQueryRequest.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public CompleteQueryRequest.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
CompleteQueryRequest.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final CompleteQueryRequest.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
CompleteQueryRequest.Builder
Overrides

setCatalog(String value)

public CompleteQueryRequest.Builder setCatalog(String value)

Required. Catalog for which the completion is performed.

Full resource name of catalog, such as projects/*/locations/global/catalogs/default_catalog.

string catalog = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }

Parameter
Name Description
value String

The catalog to set.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

setCatalogBytes(ByteString value)

public CompleteQueryRequest.Builder setCatalogBytes(ByteString value)

Required. Catalog for which the completion is performed.

Full resource name of catalog, such as projects/*/locations/global/catalogs/default_catalog.

string catalog = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }

Parameter
Name Description
value ByteString

The bytes for catalog to set.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

setDataset(String value)

public CompleteQueryRequest.Builder setDataset(String value)

Determines which dataset to use for fetching completion. "user-data" will use the imported dataset through CompletionService.ImportCompletionData. "cloud-retail" will use the dataset generated by cloud retail based on user events. If leave empty, it will use the "user-data".

Current supported values:

  • user-data

  • cloud-retail: This option requires enabling auto-learning function first. See guidelines.

string dataset = 6;

Parameter
Name Description
value String

The dataset to set.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

setDatasetBytes(ByteString value)

public CompleteQueryRequest.Builder setDatasetBytes(ByteString value)

Determines which dataset to use for fetching completion. "user-data" will use the imported dataset through CompletionService.ImportCompletionData. "cloud-retail" will use the dataset generated by cloud retail based on user events. If leave empty, it will use the "user-data".

Current supported values:

  • user-data

  • cloud-retail: This option requires enabling auto-learning function first. See guidelines.

string dataset = 6;

Parameter
Name Description
value ByteString

The bytes for dataset to set.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

setDeviceType(String value)

public CompleteQueryRequest.Builder setDeviceType(String value)

The device type context for completion suggestions. We recommend that you leave this field empty.

It can apply different suggestions on different device types, e.g. DESKTOP, MOBILE. If it is empty, the suggestions are across all device types.

Supported formats:

  • UNKNOWN_DEVICE_TYPE

  • DESKTOP

  • MOBILE

  • A customized string starts with OTHER_, e.g. OTHER_IPHONE.

string device_type = 4;

Parameter
Name Description
value String

The deviceType to set.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

setDeviceTypeBytes(ByteString value)

public CompleteQueryRequest.Builder setDeviceTypeBytes(ByteString value)

The device type context for completion suggestions. We recommend that you leave this field empty.

It can apply different suggestions on different device types, e.g. DESKTOP, MOBILE. If it is empty, the suggestions are across all device types.

Supported formats:

  • UNKNOWN_DEVICE_TYPE

  • DESKTOP

  • MOBILE

  • A customized string starts with OTHER_, e.g. OTHER_IPHONE.

string device_type = 4;

Parameter
Name Description
value ByteString

The bytes for deviceType to set.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

setEntity(String value)

public CompleteQueryRequest.Builder setEntity(String value)

The entity for customers that may run multiple different entities, domains, sites or regions, for example, Google US, Google Ads, Waymo, google.com, youtube.com, etc. If this is set, it should be exactly matched with UserEvent.entity to get per-entity autocomplete results.

string entity = 10;

Parameter
Name Description
value String

The entity to set.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

setEntityBytes(ByteString value)

public CompleteQueryRequest.Builder setEntityBytes(ByteString value)

The entity for customers that may run multiple different entities, domains, sites or regions, for example, Google US, Google Ads, Waymo, google.com, youtube.com, etc. If this is set, it should be exactly matched with UserEvent.entity to get per-entity autocomplete results.

string entity = 10;

Parameter
Name Description
value ByteString

The bytes for entity to set.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public CompleteQueryRequest.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
CompleteQueryRequest.Builder
Overrides

setLanguageCodes(int index, String value)

public CompleteQueryRequest.Builder setLanguageCodes(int index, String value)

Note that this field applies for user-data dataset only. For requests with cloud-retail dataset, setting this field has no effect.

The language filters applied to the output suggestions. If set, it should contain the language of the query. If not set, suggestions are returned without considering language restrictions. This is the BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see Tags for Identifying Languages. The maximum number of language codes is 3.

repeated string language_codes = 3;

Parameters
Name Description
index int

The index to set the value at.

value String

The languageCodes to set.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

setMaxSuggestions(int value)

public CompleteQueryRequest.Builder setMaxSuggestions(int value)

Completion max suggestions. If left unset or set to 0, then will fallback to the configured value CompletionConfig.max_suggestions.

The maximum allowed max suggestions is 20. If it is set higher, it will be capped by 20.

int32 max_suggestions = 5;

Parameter
Name Description
value int

The maxSuggestions to set.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

setQuery(String value)

public CompleteQueryRequest.Builder setQuery(String value)

Required. The query used to generate suggestions.

The maximum number of allowed characters is 255.

string query = 2 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
value String

The query to set.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

setQueryBytes(ByteString value)

public CompleteQueryRequest.Builder setQueryBytes(ByteString value)

Required. The query used to generate suggestions.

The maximum number of allowed characters is 255.

string query = 2 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
value ByteString

The bytes for query to set.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public CompleteQueryRequest.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
CompleteQueryRequest.Builder
Overrides

setUnknownFields(UnknownFieldSet unknownFields)

public final CompleteQueryRequest.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
CompleteQueryRequest.Builder
Overrides

setVisitorId(String value)

public CompleteQueryRequest.Builder setVisitorId(String value)

Required field. 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.

The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

string visitor_id = 7;

Parameter
Name Description
value String

The visitorId to set.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.

setVisitorIdBytes(ByteString value)

public CompleteQueryRequest.Builder setVisitorIdBytes(ByteString value)

Required field. 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.

The field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

string visitor_id = 7;

Parameter
Name Description
value ByteString

The bytes for visitorId to set.

Returns
Type Description
CompleteQueryRequest.Builder

This builder for chaining.