Class ServingConfig (0.51.0)

public final class ServingConfig extends GeneratedMessageV3 implements ServingConfigOrBuilder

Configures metadata that is used to generate serving time results (e.g. search results or recommendation predictions). The ServingConfig is passed in the search and predict request and generates results.

Protobuf type google.cloud.discoveryengine.v1alpha.ServingConfig

Static Fields

BOOST_CONTROL_IDS_FIELD_NUMBER

public static final int BOOST_CONTROL_IDS_FIELD_NUMBER
Field Value
Type Description
int

CREATE_TIME_FIELD_NUMBER

public static final int CREATE_TIME_FIELD_NUMBER
Field Value
Type Description
int

CUSTOM_FINE_TUNING_SPEC_FIELD_NUMBER

public static final int CUSTOM_FINE_TUNING_SPEC_FIELD_NUMBER
Field Value
Type Description
int

DISPLAY_NAME_FIELD_NUMBER

public static final int DISPLAY_NAME_FIELD_NUMBER
Field Value
Type Description
int

DISSOCIATE_CONTROL_IDS_FIELD_NUMBER

public static final int DISSOCIATE_CONTROL_IDS_FIELD_NUMBER
Field Value
Type Description
int

DIVERSITY_LEVEL_FIELD_NUMBER

public static final int DIVERSITY_LEVEL_FIELD_NUMBER
Field Value
Type Description
int

EMBEDDING_CONFIG_FIELD_NUMBER

public static final int EMBEDDING_CONFIG_FIELD_NUMBER
Field Value
Type Description
int

FILTER_CONTROL_IDS_FIELD_NUMBER

public static final int FILTER_CONTROL_IDS_FIELD_NUMBER
Field Value
Type Description
int

GENERIC_CONFIG_FIELD_NUMBER

public static final int GENERIC_CONFIG_FIELD_NUMBER
Field Value
Type Description
int

GUIDED_SEARCH_SPEC_FIELD_NUMBER

public static final int GUIDED_SEARCH_SPEC_FIELD_NUMBER
Field Value
Type Description
int

IGNORE_CONTROL_IDS_FIELD_NUMBER

public static final int IGNORE_CONTROL_IDS_FIELD_NUMBER
Field Value
Type Description
int

MEDIA_CONFIG_FIELD_NUMBER

public static final int MEDIA_CONFIG_FIELD_NUMBER
Field Value
Type Description
int

MODEL_ID_FIELD_NUMBER

public static final int MODEL_ID_FIELD_NUMBER
Field Value
Type Description
int

NAME_FIELD_NUMBER

public static final int NAME_FIELD_NUMBER
Field Value
Type Description
int

ONEWAY_SYNONYMS_CONTROL_IDS_FIELD_NUMBER

public static final int ONEWAY_SYNONYMS_CONTROL_IDS_FIELD_NUMBER
Field Value
Type Description
int

RANKING_EXPRESSION_FIELD_NUMBER

public static final int RANKING_EXPRESSION_FIELD_NUMBER
Field Value
Type Description
int

REDIRECT_CONTROL_IDS_FIELD_NUMBER

public static final int REDIRECT_CONTROL_IDS_FIELD_NUMBER
Field Value
Type Description
int

REPLACEMENT_CONTROL_IDS_FIELD_NUMBER

public static final int REPLACEMENT_CONTROL_IDS_FIELD_NUMBER
Field Value
Type Description
int

SOLUTION_TYPE_FIELD_NUMBER

public static final int SOLUTION_TYPE_FIELD_NUMBER
Field Value
Type Description
int

SYNONYMS_CONTROL_IDS_FIELD_NUMBER

public static final int SYNONYMS_CONTROL_IDS_FIELD_NUMBER
Field Value
Type Description
int

UPDATE_TIME_FIELD_NUMBER

public static final int UPDATE_TIME_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static ServingConfig getDefaultInstance()
Returns
Type Description
ServingConfig

getDescriptor()

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

newBuilder()

public static ServingConfig.Builder newBuilder()
Returns
Type Description
ServingConfig.Builder

newBuilder(ServingConfig prototype)

public static ServingConfig.Builder newBuilder(ServingConfig prototype)
Parameter
Name Description
prototype ServingConfig
Returns
Type Description
ServingConfig.Builder

parseDelimitedFrom(InputStream input)

public static ServingConfig parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
ServingConfig
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static ServingConfig parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
ServingConfig
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static ServingConfig parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
ServingConfig
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static ServingConfig parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
ServingConfig
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static ServingConfig parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
ServingConfig
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static ServingConfig parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
ServingConfig
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static ServingConfig parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
ServingConfig
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static ServingConfig parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
ServingConfig
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static ServingConfig parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
ServingConfig
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static ServingConfig parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
ServingConfig
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static ServingConfig parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
ServingConfig
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static ServingConfig parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
ServingConfig
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<ServingConfig> parser()
Returns
Type Description
Parser<ServingConfig>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getBoostControlIds(int index)

public String getBoostControlIds(int index)

Boost controls to use in serving path. All triggered boost controls will be applied. Boost controls must be in the same data store as the serving config. Maximum of 20 boost controls.

repeated string boost_control_ids = 12;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The boostControlIds at the given index.

getBoostControlIdsBytes(int index)

public ByteString getBoostControlIdsBytes(int index)

Boost controls to use in serving path. All triggered boost controls will be applied. Boost controls must be in the same data store as the serving config. Maximum of 20 boost controls.

repeated string boost_control_ids = 12;

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the boostControlIds at the given index.

getBoostControlIdsCount()

public int getBoostControlIdsCount()

Boost controls to use in serving path. All triggered boost controls will be applied. Boost controls must be in the same data store as the serving config. Maximum of 20 boost controls.

repeated string boost_control_ids = 12;

Returns
Type Description
int

The count of boostControlIds.

getBoostControlIdsList()

public ProtocolStringList getBoostControlIdsList()

Boost controls to use in serving path. All triggered boost controls will be applied. Boost controls must be in the same data store as the serving config. Maximum of 20 boost controls.

repeated string boost_control_ids = 12;

Returns
Type Description
ProtocolStringList

A list containing the boostControlIds.

getCreateTime()

public Timestamp getCreateTime()

Output only. ServingConfig created timestamp.

.google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Timestamp

The createTime.

getCreateTimeOrBuilder()

public TimestampOrBuilder getCreateTimeOrBuilder()

Output only. ServingConfig created timestamp.

.google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
TimestampOrBuilder

getCustomFineTuningSpec()

public CustomFineTuningSpec getCustomFineTuningSpec()

Custom fine tuning configs. If SearchRequest.custom_fine_tuning_spec is set, it has higher priority than the configs set here.

.google.cloud.discoveryengine.v1alpha.CustomFineTuningSpec custom_fine_tuning_spec = 24;

Returns
Type Description
CustomFineTuningSpec

The customFineTuningSpec.

getCustomFineTuningSpecOrBuilder()

public CustomFineTuningSpecOrBuilder getCustomFineTuningSpecOrBuilder()

Custom fine tuning configs. If SearchRequest.custom_fine_tuning_spec is set, it has higher priority than the configs set here.

.google.cloud.discoveryengine.v1alpha.CustomFineTuningSpec custom_fine_tuning_spec = 24;

Returns
Type Description
CustomFineTuningSpecOrBuilder

getDefaultInstanceForType()

public ServingConfig getDefaultInstanceForType()
Returns
Type Description
ServingConfig

getDisplayName()

public String getDisplayName()

Required. The human readable serving config display name. Used in Discovery UI.

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

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

Returns
Type Description
String

The displayName.

getDisplayNameBytes()

public ByteString getDisplayNameBytes()

Required. The human readable serving config display name. Used in Discovery UI.

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

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

Returns
Type Description
ByteString

The bytes for displayName.

getDissociateControlIds(int index)

public String getDissociateControlIds(int index)

Condition do not associate specifications. If multiple do not associate conditions match, all matching do not associate controls in the list will execute. Order does not matter. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string dissociate_control_ids = 17;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The dissociateControlIds at the given index.

getDissociateControlIdsBytes(int index)

public ByteString getDissociateControlIdsBytes(int index)

Condition do not associate specifications. If multiple do not associate conditions match, all matching do not associate controls in the list will execute. Order does not matter. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string dissociate_control_ids = 17;

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the dissociateControlIds at the given index.

getDissociateControlIdsCount()

public int getDissociateControlIdsCount()

Condition do not associate specifications. If multiple do not associate conditions match, all matching do not associate controls in the list will execute. Order does not matter. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string dissociate_control_ids = 17;

Returns
Type Description
int

The count of dissociateControlIds.

getDissociateControlIdsList()

public ProtocolStringList getDissociateControlIdsList()

Condition do not associate specifications. If multiple do not associate conditions match, all matching do not associate controls in the list will execute. Order does not matter. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string dissociate_control_ids = 17;

Returns
Type Description
ProtocolStringList

A list containing the dissociateControlIds.

getDiversityLevel()

public String getDiversityLevel()

How much diversity to use in recommendation model results e.g. medium-diversity or high-diversity. Currently supported values:

  • no-diversity
  • low-diversity
  • medium-diversity
  • high-diversity
  • auto-diversity

    If not specified, we choose default based on recommendation model type. Default value: no-diversity.

    Can only be set if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

string diversity_level = 5;

Returns
Type Description
String

The diversityLevel.

getDiversityLevelBytes()

public ByteString getDiversityLevelBytes()

How much diversity to use in recommendation model results e.g. medium-diversity or high-diversity. Currently supported values:

  • no-diversity
  • low-diversity
  • medium-diversity
  • high-diversity
  • auto-diversity

    If not specified, we choose default based on recommendation model type. Default value: no-diversity.

    Can only be set if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

string diversity_level = 5;

Returns
Type Description
ByteString

The bytes for diversityLevel.

getEmbeddingConfig()

public EmbeddingConfig getEmbeddingConfig()

Bring your own embedding config. The config is used for search semantic retrieval. The retrieval is based on the dot product of SearchRequest.EmbeddingSpec.EmbeddingVector.vector and the document embeddings that are provided by this EmbeddingConfig. If SearchRequest.EmbeddingSpec.EmbeddingVector.vector is provided, it overrides this ServingConfig.embedding_config.

.google.cloud.discoveryengine.v1alpha.EmbeddingConfig embedding_config = 20;

Returns
Type Description
EmbeddingConfig

The embeddingConfig.

getEmbeddingConfigOrBuilder()

public EmbeddingConfigOrBuilder getEmbeddingConfigOrBuilder()

Bring your own embedding config. The config is used for search semantic retrieval. The retrieval is based on the dot product of SearchRequest.EmbeddingSpec.EmbeddingVector.vector and the document embeddings that are provided by this EmbeddingConfig. If SearchRequest.EmbeddingSpec.EmbeddingVector.vector is provided, it overrides this ServingConfig.embedding_config.

.google.cloud.discoveryengine.v1alpha.EmbeddingConfig embedding_config = 20;

Returns
Type Description
EmbeddingConfigOrBuilder

getFilterControlIds(int index)

public String getFilterControlIds(int index)

Filter controls to use in serving path. All triggered filter controls will be applied. Filter controls must be in the same data store as the serving config. Maximum of 20 filter controls.

repeated string filter_control_ids = 11;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The filterControlIds at the given index.

getFilterControlIdsBytes(int index)

public ByteString getFilterControlIdsBytes(int index)

Filter controls to use in serving path. All triggered filter controls will be applied. Filter controls must be in the same data store as the serving config. Maximum of 20 filter controls.

repeated string filter_control_ids = 11;

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the filterControlIds at the given index.

getFilterControlIdsCount()

public int getFilterControlIdsCount()

Filter controls to use in serving path. All triggered filter controls will be applied. Filter controls must be in the same data store as the serving config. Maximum of 20 filter controls.

repeated string filter_control_ids = 11;

Returns
Type Description
int

The count of filterControlIds.

getFilterControlIdsList()

public ProtocolStringList getFilterControlIdsList()

Filter controls to use in serving path. All triggered filter controls will be applied. Filter controls must be in the same data store as the serving config. Maximum of 20 filter controls.

repeated string filter_control_ids = 11;

Returns
Type Description
ProtocolStringList

A list containing the filterControlIds.

getGenericConfig()

public ServingConfig.GenericConfig getGenericConfig()

The GenericConfig of the serving configuration.

.google.cloud.discoveryengine.v1alpha.ServingConfig.GenericConfig generic_config = 10;

Returns
Type Description
ServingConfig.GenericConfig

The genericConfig.

getGenericConfigOrBuilder()

public ServingConfig.GenericConfigOrBuilder getGenericConfigOrBuilder()

The GenericConfig of the serving configuration.

.google.cloud.discoveryengine.v1alpha.ServingConfig.GenericConfig generic_config = 10;

Returns
Type Description
ServingConfig.GenericConfigOrBuilder

getGuidedSearchSpec()

public GuidedSearchSpec getGuidedSearchSpec()

Guided search configs.

.google.cloud.discoveryengine.v1alpha.GuidedSearchSpec guided_search_spec = 22;

Returns
Type Description
GuidedSearchSpec

The guidedSearchSpec.

getGuidedSearchSpecOrBuilder()

public GuidedSearchSpecOrBuilder getGuidedSearchSpecOrBuilder()

Guided search configs.

.google.cloud.discoveryengine.v1alpha.GuidedSearchSpec guided_search_spec = 22;

Returns
Type Description
GuidedSearchSpecOrBuilder

getIgnoreControlIds(int index)

public String getIgnoreControlIds(int index)

Condition ignore specifications. If multiple ignore conditions match, all matching ignore controls in the list will execute. Order does not matter. Maximum number of specifications is 100.

repeated string ignore_control_ids = 19;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The ignoreControlIds at the given index.

getIgnoreControlIdsBytes(int index)

public ByteString getIgnoreControlIdsBytes(int index)

Condition ignore specifications. If multiple ignore conditions match, all matching ignore controls in the list will execute. Order does not matter. Maximum number of specifications is 100.

repeated string ignore_control_ids = 19;

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the ignoreControlIds at the given index.

getIgnoreControlIdsCount()

public int getIgnoreControlIdsCount()

Condition ignore specifications. If multiple ignore conditions match, all matching ignore controls in the list will execute. Order does not matter. Maximum number of specifications is 100.

repeated string ignore_control_ids = 19;

Returns
Type Description
int

The count of ignoreControlIds.

getIgnoreControlIdsList()

public ProtocolStringList getIgnoreControlIdsList()

Condition ignore specifications. If multiple ignore conditions match, all matching ignore controls in the list will execute. Order does not matter. Maximum number of specifications is 100.

repeated string ignore_control_ids = 19;

Returns
Type Description
ProtocolStringList

A list containing the ignoreControlIds.

getMediaConfig()

public ServingConfig.MediaConfig getMediaConfig()

The MediaConfig of the serving configuration.

.google.cloud.discoveryengine.v1alpha.ServingConfig.MediaConfig media_config = 7;

Returns
Type Description
ServingConfig.MediaConfig

The mediaConfig.

getMediaConfigOrBuilder()

public ServingConfig.MediaConfigOrBuilder getMediaConfigOrBuilder()

The MediaConfig of the serving configuration.

.google.cloud.discoveryengine.v1alpha.ServingConfig.MediaConfig media_config = 7;

Returns
Type Description
ServingConfig.MediaConfigOrBuilder

getModelId()

public String getModelId()

The id of the model to use at serving time. Currently only RecommendationModels are supported. Can be changed but only to a compatible model (e.g. others-you-may-like CTR to others-you-may-like CVR).

Required when SolutionType is SOLUTION_TYPE_RECOMMENDATION.

string model_id = 4;

Returns
Type Description
String

The modelId.

getModelIdBytes()

public ByteString getModelIdBytes()

The id of the model to use at serving time. Currently only RecommendationModels are supported. Can be changed but only to a compatible model (e.g. others-you-may-like CTR to others-you-may-like CVR).

Required when SolutionType is SOLUTION_TYPE_RECOMMENDATION.

string model_id = 4;

Returns
Type Description
ByteString

The bytes for modelId.

getName()

public String getName()

Immutable. Fully qualified name projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}/servingConfigs/{serving_config_id}

string name = 1 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
String

The name.

getNameBytes()

public ByteString getNameBytes()

Immutable. Fully qualified name projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}/servingConfigs/{serving_config_id}

string name = 1 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
ByteString

The bytes for name.

getOnewaySynonymsControlIds(int index)

public String getOnewaySynonymsControlIds(int index)

Condition oneway synonyms specifications. If multiple oneway synonyms conditions match, all matching oneway synonyms controls in the list will execute. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string oneway_synonyms_control_ids = 16;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The onewaySynonymsControlIds at the given index.

getOnewaySynonymsControlIdsBytes(int index)

public ByteString getOnewaySynonymsControlIdsBytes(int index)

Condition oneway synonyms specifications. If multiple oneway synonyms conditions match, all matching oneway synonyms controls in the list will execute. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string oneway_synonyms_control_ids = 16;

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the onewaySynonymsControlIds at the given index.

getOnewaySynonymsControlIdsCount()

public int getOnewaySynonymsControlIdsCount()

Condition oneway synonyms specifications. If multiple oneway synonyms conditions match, all matching oneway synonyms controls in the list will execute. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string oneway_synonyms_control_ids = 16;

Returns
Type Description
int

The count of onewaySynonymsControlIds.

getOnewaySynonymsControlIdsList()

public ProtocolStringList getOnewaySynonymsControlIdsList()

Condition oneway synonyms specifications. If multiple oneway synonyms conditions match, all matching oneway synonyms controls in the list will execute. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string oneway_synonyms_control_ids = 16;

Returns
Type Description
ProtocolStringList

A list containing the onewaySynonymsControlIds.

getParserForType()

public Parser<ServingConfig> getParserForType()
Returns
Type Description
Parser<ServingConfig>
Overrides

getRankingExpression()

public String getRankingExpression()

The ranking expression controls the customized ranking on retrieval documents. To leverage this, document embedding is required. The ranking expression setting in ServingConfig applies to all search requests served by the serving config. However, if SearchRequest.ranking_expression is specified, it overrides the ServingConfig ranking expression.

The ranking expression is a single function or multiple functions that are joined by "+".

  • ranking_expression = function, { " + ", function };

    Supported functions:

  • double * relevance_score

  • double * dotProduct(embedding_field_path)

    Function variables:

  • relevance_score: pre-defined keywords, used for measure relevance between query and document.

  • embedding_field_path: the document embedding field used with query embedding vector.
  • dotProduct: embedding function between embedding_field_path and query embedding vector.

    Example ranking expression:

    If document has an embedding field doc_embedding, the ranking expression could be 0.5 * relevance_score + 0.3 * dotProduct(doc_embedding).

string ranking_expression = 21;

Returns
Type Description
String

The rankingExpression.

getRankingExpressionBytes()

public ByteString getRankingExpressionBytes()

The ranking expression controls the customized ranking on retrieval documents. To leverage this, document embedding is required. The ranking expression setting in ServingConfig applies to all search requests served by the serving config. However, if SearchRequest.ranking_expression is specified, it overrides the ServingConfig ranking expression.

The ranking expression is a single function or multiple functions that are joined by "+".

  • ranking_expression = function, { " + ", function };

    Supported functions:

  • double * relevance_score

  • double * dotProduct(embedding_field_path)

    Function variables:

  • relevance_score: pre-defined keywords, used for measure relevance between query and document.

  • embedding_field_path: the document embedding field used with query embedding vector.
  • dotProduct: embedding function between embedding_field_path and query embedding vector.

    Example ranking expression:

    If document has an embedding field doc_embedding, the ranking expression could be 0.5 * relevance_score + 0.3 * dotProduct(doc_embedding).

string ranking_expression = 21;

Returns
Type Description
ByteString

The bytes for rankingExpression.

getRedirectControlIds(int index)

public String getRedirectControlIds(int index)

IDs of the redirect controls. Only the first triggered redirect action is applied, even if multiple apply. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string redirect_control_ids = 14;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The redirectControlIds at the given index.

getRedirectControlIdsBytes(int index)

public ByteString getRedirectControlIdsBytes(int index)

IDs of the redirect controls. Only the first triggered redirect action is applied, even if multiple apply. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string redirect_control_ids = 14;

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the redirectControlIds at the given index.

getRedirectControlIdsCount()

public int getRedirectControlIdsCount()

IDs of the redirect controls. Only the first triggered redirect action is applied, even if multiple apply. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string redirect_control_ids = 14;

Returns
Type Description
int

The count of redirectControlIds.

getRedirectControlIdsList()

public ProtocolStringList getRedirectControlIdsList()

IDs of the redirect controls. Only the first triggered redirect action is applied, even if multiple apply. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string redirect_control_ids = 14;

Returns
Type Description
ProtocolStringList

A list containing the redirectControlIds.

getReplacementControlIds(int index)

public String getReplacementControlIds(int index)

Condition replacement specifications. Applied according to the order in the list. A previously replaced term can not be re-replaced. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string replacement_control_ids = 18;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The replacementControlIds at the given index.

getReplacementControlIdsBytes(int index)

public ByteString getReplacementControlIdsBytes(int index)

Condition replacement specifications. Applied according to the order in the list. A previously replaced term can not be re-replaced. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string replacement_control_ids = 18;

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the replacementControlIds at the given index.

getReplacementControlIdsCount()

public int getReplacementControlIdsCount()

Condition replacement specifications. Applied according to the order in the list. A previously replaced term can not be re-replaced. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string replacement_control_ids = 18;

Returns
Type Description
int

The count of replacementControlIds.

getReplacementControlIdsList()

public ProtocolStringList getReplacementControlIdsList()

Condition replacement specifications. Applied according to the order in the list. A previously replaced term can not be re-replaced. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string replacement_control_ids = 18;

Returns
Type Description
ProtocolStringList

A list containing the replacementControlIds.

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

getSolutionType()

public SolutionType getSolutionType()

Required. Immutable. Specifies the solution type that a serving config can be associated with.

.google.cloud.discoveryengine.v1alpha.SolutionType solution_type = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
SolutionType

The solutionType.

getSolutionTypeValue()

public int getSolutionTypeValue()

Required. Immutable. Specifies the solution type that a serving config can be associated with.

.google.cloud.discoveryengine.v1alpha.SolutionType solution_type = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
int

The enum numeric value on the wire for solutionType.

getSynonymsControlIds(int index)

public String getSynonymsControlIds(int index)

Condition synonyms specifications. If multiple synonyms conditions match, all matching synonyms controls in the list will execute. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string synonyms_control_ids = 15;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The synonymsControlIds at the given index.

getSynonymsControlIdsBytes(int index)

public ByteString getSynonymsControlIdsBytes(int index)

Condition synonyms specifications. If multiple synonyms conditions match, all matching synonyms controls in the list will execute. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string synonyms_control_ids = 15;

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the synonymsControlIds at the given index.

getSynonymsControlIdsCount()

public int getSynonymsControlIdsCount()

Condition synonyms specifications. If multiple synonyms conditions match, all matching synonyms controls in the list will execute. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string synonyms_control_ids = 15;

Returns
Type Description
int

The count of synonymsControlIds.

getSynonymsControlIdsList()

public ProtocolStringList getSynonymsControlIdsList()

Condition synonyms specifications. If multiple synonyms conditions match, all matching synonyms controls in the list will execute. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

repeated string synonyms_control_ids = 15;

Returns
Type Description
ProtocolStringList

A list containing the synonymsControlIds.

getUpdateTime()

public Timestamp getUpdateTime()

Output only. ServingConfig updated timestamp.

.google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Timestamp

The updateTime.

getUpdateTimeOrBuilder()

public TimestampOrBuilder getUpdateTimeOrBuilder()

Output only. ServingConfig updated timestamp.

.google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
TimestampOrBuilder

getVerticalConfigCase()

public ServingConfig.VerticalConfigCase getVerticalConfigCase()
Returns
Type Description
ServingConfig.VerticalConfigCase

hasCreateTime()

public boolean hasCreateTime()

Output only. ServingConfig created timestamp.

.google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the createTime field is set.

hasCustomFineTuningSpec()

public boolean hasCustomFineTuningSpec()

Custom fine tuning configs. If SearchRequest.custom_fine_tuning_spec is set, it has higher priority than the configs set here.

.google.cloud.discoveryengine.v1alpha.CustomFineTuningSpec custom_fine_tuning_spec = 24;

Returns
Type Description
boolean

Whether the customFineTuningSpec field is set.

hasEmbeddingConfig()

public boolean hasEmbeddingConfig()

Bring your own embedding config. The config is used for search semantic retrieval. The retrieval is based on the dot product of SearchRequest.EmbeddingSpec.EmbeddingVector.vector and the document embeddings that are provided by this EmbeddingConfig. If SearchRequest.EmbeddingSpec.EmbeddingVector.vector is provided, it overrides this ServingConfig.embedding_config.

.google.cloud.discoveryengine.v1alpha.EmbeddingConfig embedding_config = 20;

Returns
Type Description
boolean

Whether the embeddingConfig field is set.

hasGenericConfig()

public boolean hasGenericConfig()

The GenericConfig of the serving configuration.

.google.cloud.discoveryengine.v1alpha.ServingConfig.GenericConfig generic_config = 10;

Returns
Type Description
boolean

Whether the genericConfig field is set.

hasGuidedSearchSpec()

public boolean hasGuidedSearchSpec()

Guided search configs.

.google.cloud.discoveryengine.v1alpha.GuidedSearchSpec guided_search_spec = 22;

Returns
Type Description
boolean

Whether the guidedSearchSpec field is set.

hasMediaConfig()

public boolean hasMediaConfig()

The MediaConfig of the serving configuration.

.google.cloud.discoveryengine.v1alpha.ServingConfig.MediaConfig media_config = 7;

Returns
Type Description
boolean

Whether the mediaConfig field is set.

hasUpdateTime()

public boolean hasUpdateTime()

Output only. ServingConfig updated timestamp.

.google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the updateTime field is set.

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

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

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public ServingConfig.Builder newBuilderForType()
Returns
Type Description
ServingConfig.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected ServingConfig.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
ServingConfig.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

public ServingConfig.Builder toBuilder()
Returns
Type Description
ServingConfig.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException