Class RankRequest.Builder (0.43.0)

public static final class RankRequest.Builder extends GeneratedMessageV3.Builder<RankRequest.Builder> implements RankRequestOrBuilder

Request message for RankService.Rank method.

Protobuf type google.cloud.discoveryengine.v1.RankRequest

Static Methods

getDescriptor()

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

Methods

addAllRecords(Iterable<? extends RankingRecord> values)

public RankRequest.Builder addAllRecords(Iterable<? extends RankingRecord> values)

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
values Iterable<? extends com.google.cloud.discoveryengine.v1.RankingRecord>
Returns
Type Description
RankRequest.Builder

addRecords(RankingRecord value)

public RankRequest.Builder addRecords(RankingRecord value)

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
value RankingRecord
Returns
Type Description
RankRequest.Builder

addRecords(RankingRecord.Builder builderForValue)

public RankRequest.Builder addRecords(RankingRecord.Builder builderForValue)

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
builderForValue RankingRecord.Builder
Returns
Type Description
RankRequest.Builder

addRecords(int index, RankingRecord value)

public RankRequest.Builder addRecords(int index, RankingRecord value)

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Parameters
Name Description
index int
value RankingRecord
Returns
Type Description
RankRequest.Builder

addRecords(int index, RankingRecord.Builder builderForValue)

public RankRequest.Builder addRecords(int index, RankingRecord.Builder builderForValue)

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Parameters
Name Description
index int
builderForValue RankingRecord.Builder
Returns
Type Description
RankRequest.Builder

addRecordsBuilder()

public RankingRecord.Builder addRecordsBuilder()

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
RankingRecord.Builder

addRecordsBuilder(int index)

public RankingRecord.Builder addRecordsBuilder(int index)

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
index int
Returns
Type Description
RankingRecord.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

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

build()

public RankRequest build()
Returns
Type Description
RankRequest

buildPartial()

public RankRequest buildPartial()
Returns
Type Description
RankRequest

clear()

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

clearField(Descriptors.FieldDescriptor field)

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

clearIgnoreRecordDetailsInResponse()

public RankRequest.Builder clearIgnoreRecordDetailsInResponse()

If true, the response will contain only record ID and score. By default, it is false, the response will contain record details.

bool ignore_record_details_in_response = 6;

Returns
Type Description
RankRequest.Builder

This builder for chaining.

clearModel()

public RankRequest.Builder clearModel()

The identifier of the model to use. It is one of:

  • semantic-ranker-512@latest: Semantic ranking model with maxiumn input token size 512.

    It is set to semantic-ranker-512@latest by default if unspecified.

string model = 2;

Returns
Type Description
RankRequest.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

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

clearQuery()

public RankRequest.Builder clearQuery()

The query to use.

string query = 4;

Returns
Type Description
RankRequest.Builder

This builder for chaining.

clearRankingConfig()

public RankRequest.Builder clearRankingConfig()

Required. The resource name of the rank service config, such as projects/{project_num}/locations/{location_id}/rankingConfigs/default_ranking_config.

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

Returns
Type Description
RankRequest.Builder

This builder for chaining.

clearRecords()

public RankRequest.Builder clearRecords()

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
RankRequest.Builder

clearTopN()

public RankRequest.Builder clearTopN()

The number of results to return. If this is unset or no bigger than zero, returns all results.

int32 top_n = 3;

Returns
Type Description
RankRequest.Builder

This builder for chaining.

clearUserLabels()

public RankRequest.Builder clearUserLabels()
Returns
Type Description
RankRequest.Builder

clone()

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

containsUserLabels(String key)

public boolean containsUserLabels(String key)

The user labels applied to a resource must meet the following requirements:

  • Each resource can have multiple labels, up to a maximum of 64.
  • Each label must be a key-value pair.
  • Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
  • Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
  • The key portion of a label must be unique. However, you can use the same key with multiple resources.
  • Keys must start with a lowercase letter or international character.

    See Google Cloud Document for more details.

map<string, string> user_labels = 7;

Parameter
Name Description
key String
Returns
Type Description
boolean

getDefaultInstanceForType()

public RankRequest getDefaultInstanceForType()
Returns
Type Description
RankRequest

getDescriptorForType()

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

getIgnoreRecordDetailsInResponse()

public boolean getIgnoreRecordDetailsInResponse()

If true, the response will contain only record ID and score. By default, it is false, the response will contain record details.

bool ignore_record_details_in_response = 6;

Returns
Type Description
boolean

The ignoreRecordDetailsInResponse.

getModel()

public String getModel()

The identifier of the model to use. It is one of:

  • semantic-ranker-512@latest: Semantic ranking model with maxiumn input token size 512.

    It is set to semantic-ranker-512@latest by default if unspecified.

string model = 2;

Returns
Type Description
String

The model.

getModelBytes()

public ByteString getModelBytes()

The identifier of the model to use. It is one of:

  • semantic-ranker-512@latest: Semantic ranking model with maxiumn input token size 512.

    It is set to semantic-ranker-512@latest by default if unspecified.

string model = 2;

Returns
Type Description
ByteString

The bytes for model.

getMutableUserLabels() (deprecated)

public Map<String,String> getMutableUserLabels()

Use alternate mutation accessors instead.

Returns
Type Description
Map<String,String>

getQuery()

public String getQuery()

The query to use.

string query = 4;

Returns
Type Description
String

The query.

getQueryBytes()

public ByteString getQueryBytes()

The query to use.

string query = 4;

Returns
Type Description
ByteString

The bytes for query.

getRankingConfig()

public String getRankingConfig()

Required. The resource name of the rank service config, such as projects/{project_num}/locations/{location_id}/rankingConfigs/default_ranking_config.

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

Returns
Type Description
String

The rankingConfig.

getRankingConfigBytes()

public ByteString getRankingConfigBytes()

Required. The resource name of the rank service config, such as projects/{project_num}/locations/{location_id}/rankingConfigs/default_ranking_config.

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

Returns
Type Description
ByteString

The bytes for rankingConfig.

getRecords(int index)

public RankingRecord getRecords(int index)

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
index int
Returns
Type Description
RankingRecord

getRecordsBuilder(int index)

public RankingRecord.Builder getRecordsBuilder(int index)

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
index int
Returns
Type Description
RankingRecord.Builder

getRecordsBuilderList()

public List<RankingRecord.Builder> getRecordsBuilderList()

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
List<Builder>

getRecordsCount()

public int getRecordsCount()

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
int

getRecordsList()

public List<RankingRecord> getRecordsList()

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
List<RankingRecord>

getRecordsOrBuilder(int index)

public RankingRecordOrBuilder getRecordsOrBuilder(int index)

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
index int
Returns
Type Description
RankingRecordOrBuilder

getRecordsOrBuilderList()

public List<? extends RankingRecordOrBuilder> getRecordsOrBuilderList()

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
List<? extends com.google.cloud.discoveryengine.v1.RankingRecordOrBuilder>

getTopN()

public int getTopN()

The number of results to return. If this is unset or no bigger than zero, returns all results.

int32 top_n = 3;

Returns
Type Description
int

The topN.

getUserLabels() (deprecated)

public Map<String,String> getUserLabels()

Use #getUserLabelsMap() instead.

Returns
Type Description
Map<String,String>

getUserLabelsCount()

public int getUserLabelsCount()

The user labels applied to a resource must meet the following requirements:

  • Each resource can have multiple labels, up to a maximum of 64.
  • Each label must be a key-value pair.
  • Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
  • Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
  • The key portion of a label must be unique. However, you can use the same key with multiple resources.
  • Keys must start with a lowercase letter or international character.

    See Google Cloud Document for more details.

map<string, string> user_labels = 7;

Returns
Type Description
int

getUserLabelsMap()

public Map<String,String> getUserLabelsMap()

The user labels applied to a resource must meet the following requirements:

  • Each resource can have multiple labels, up to a maximum of 64.
  • Each label must be a key-value pair.
  • Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
  • Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
  • The key portion of a label must be unique. However, you can use the same key with multiple resources.
  • Keys must start with a lowercase letter or international character.

    See Google Cloud Document for more details.

map<string, string> user_labels = 7;

Returns
Type Description
Map<String,String>

getUserLabelsOrDefault(String key, String defaultValue)

public String getUserLabelsOrDefault(String key, String defaultValue)

The user labels applied to a resource must meet the following requirements:

  • Each resource can have multiple labels, up to a maximum of 64.
  • Each label must be a key-value pair.
  • Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
  • Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
  • The key portion of a label must be unique. However, you can use the same key with multiple resources.
  • Keys must start with a lowercase letter or international character.

    See Google Cloud Document for more details.

map<string, string> user_labels = 7;

Parameters
Name Description
key String
defaultValue String
Returns
Type Description
String

getUserLabelsOrThrow(String key)

public String getUserLabelsOrThrow(String key)

The user labels applied to a resource must meet the following requirements:

  • Each resource can have multiple labels, up to a maximum of 64.
  • Each label must be a key-value pair.
  • Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
  • Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
  • The key portion of a label must be unique. However, you can use the same key with multiple resources.
  • Keys must start with a lowercase letter or international character.

    See Google Cloud Document for more details.

map<string, string> user_labels = 7;

Parameter
Name Description
key String
Returns
Type Description
String

internalGetFieldAccessorTable()

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

internalGetMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMapFieldReflection(int)

internalGetMutableMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMutableMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int)

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(RankRequest other)

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

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

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

mergeUnknownFields(UnknownFieldSet unknownFields)

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

putAllUserLabels(Map<String,String> values)

public RankRequest.Builder putAllUserLabels(Map<String,String> values)

The user labels applied to a resource must meet the following requirements:

  • Each resource can have multiple labels, up to a maximum of 64.
  • Each label must be a key-value pair.
  • Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
  • Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
  • The key portion of a label must be unique. However, you can use the same key with multiple resources.
  • Keys must start with a lowercase letter or international character.

    See Google Cloud Document for more details.

map<string, string> user_labels = 7;

Parameter
Name Description
values Map<String,String>
Returns
Type Description
RankRequest.Builder

putUserLabels(String key, String value)

public RankRequest.Builder putUserLabels(String key, String value)

The user labels applied to a resource must meet the following requirements:

  • Each resource can have multiple labels, up to a maximum of 64.
  • Each label must be a key-value pair.
  • Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
  • Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
  • The key portion of a label must be unique. However, you can use the same key with multiple resources.
  • Keys must start with a lowercase letter or international character.

    See Google Cloud Document for more details.

map<string, string> user_labels = 7;

Parameters
Name Description
key String
value String
Returns
Type Description
RankRequest.Builder

removeRecords(int index)

public RankRequest.Builder removeRecords(int index)

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
index int
Returns
Type Description
RankRequest.Builder

removeUserLabels(String key)

public RankRequest.Builder removeUserLabels(String key)

The user labels applied to a resource must meet the following requirements:

  • Each resource can have multiple labels, up to a maximum of 64.
  • Each label must be a key-value pair.
  • Keys have a minimum length of 1 character and a maximum length of 63 characters and cannot be empty. Values can be empty and have a maximum length of 63 characters.
  • Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. All characters must use UTF-8 encoding, and international characters are allowed.
  • The key portion of a label must be unique. However, you can use the same key with multiple resources.
  • Keys must start with a lowercase letter or international character.

    See Google Cloud Document for more details.

map<string, string> user_labels = 7;

Parameter
Name Description
key String
Returns
Type Description
RankRequest.Builder

setField(Descriptors.FieldDescriptor field, Object value)

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

setIgnoreRecordDetailsInResponse(boolean value)

public RankRequest.Builder setIgnoreRecordDetailsInResponse(boolean value)

If true, the response will contain only record ID and score. By default, it is false, the response will contain record details.

bool ignore_record_details_in_response = 6;

Parameter
Name Description
value boolean

The ignoreRecordDetailsInResponse to set.

Returns
Type Description
RankRequest.Builder

This builder for chaining.

setModel(String value)

public RankRequest.Builder setModel(String value)

The identifier of the model to use. It is one of:

  • semantic-ranker-512@latest: Semantic ranking model with maxiumn input token size 512.

    It is set to semantic-ranker-512@latest by default if unspecified.

string model = 2;

Parameter
Name Description
value String

The model to set.

Returns
Type Description
RankRequest.Builder

This builder for chaining.

setModelBytes(ByteString value)

public RankRequest.Builder setModelBytes(ByteString value)

The identifier of the model to use. It is one of:

  • semantic-ranker-512@latest: Semantic ranking model with maxiumn input token size 512.

    It is set to semantic-ranker-512@latest by default if unspecified.

string model = 2;

Parameter
Name Description
value ByteString

The bytes for model to set.

Returns
Type Description
RankRequest.Builder

This builder for chaining.

setQuery(String value)

public RankRequest.Builder setQuery(String value)

The query to use.

string query = 4;

Parameter
Name Description
value String

The query to set.

Returns
Type Description
RankRequest.Builder

This builder for chaining.

setQueryBytes(ByteString value)

public RankRequest.Builder setQueryBytes(ByteString value)

The query to use.

string query = 4;

Parameter
Name Description
value ByteString

The bytes for query to set.

Returns
Type Description
RankRequest.Builder

This builder for chaining.

setRankingConfig(String value)

public RankRequest.Builder setRankingConfig(String value)

Required. The resource name of the rank service config, such as projects/{project_num}/locations/{location_id}/rankingConfigs/default_ranking_config.

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

Parameter
Name Description
value String

The rankingConfig to set.

Returns
Type Description
RankRequest.Builder

This builder for chaining.

setRankingConfigBytes(ByteString value)

public RankRequest.Builder setRankingConfigBytes(ByteString value)

Required. The resource name of the rank service config, such as projects/{project_num}/locations/{location_id}/rankingConfigs/default_ranking_config.

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

Parameter
Name Description
value ByteString

The bytes for rankingConfig to set.

Returns
Type Description
RankRequest.Builder

This builder for chaining.

setRecords(int index, RankingRecord value)

public RankRequest.Builder setRecords(int index, RankingRecord value)

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Parameters
Name Description
index int
value RankingRecord
Returns
Type Description
RankRequest.Builder

setRecords(int index, RankingRecord.Builder builderForValue)

public RankRequest.Builder setRecords(int index, RankingRecord.Builder builderForValue)

Required. A list of records to rank. At most 200 records to rank.

repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED];

Parameters
Name Description
index int
builderForValue RankingRecord.Builder
Returns
Type Description
RankRequest.Builder

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

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

setTopN(int value)

public RankRequest.Builder setTopN(int value)

The number of results to return. If this is unset or no bigger than zero, returns all results.

int32 top_n = 3;

Parameter
Name Description
value int

The topN to set.

Returns
Type Description
RankRequest.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

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