Class NearestNeighborQuery (3.46.0)

public final class NearestNeighborQuery extends GeneratedMessageV3 implements NearestNeighborQueryOrBuilder

A query to find a number of similar entities.

Protobuf type google.cloud.aiplatform.v1.NearestNeighborQuery

Static Fields

EMBEDDING_FIELD_NUMBER

public static final int EMBEDDING_FIELD_NUMBER
Field Value
Type Description
int

ENTITY_ID_FIELD_NUMBER

public static final int ENTITY_ID_FIELD_NUMBER
Field Value
Type Description
int

NEIGHBOR_COUNT_FIELD_NUMBER

public static final int NEIGHBOR_COUNT_FIELD_NUMBER
Field Value
Type Description
int

PARAMETERS_FIELD_NUMBER

public static final int PARAMETERS_FIELD_NUMBER
Field Value
Type Description
int

PER_CROWDING_ATTRIBUTE_NEIGHBOR_COUNT_FIELD_NUMBER

public static final int PER_CROWDING_ATTRIBUTE_NEIGHBOR_COUNT_FIELD_NUMBER
Field Value
Type Description
int

STRING_FILTERS_FIELD_NUMBER

public static final int STRING_FILTERS_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static NearestNeighborQuery getDefaultInstance()
Returns
Type Description
NearestNeighborQuery

getDescriptor()

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

newBuilder()

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

newBuilder(NearestNeighborQuery prototype)

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

parseDelimitedFrom(InputStream input)

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

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

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

parseFrom(byte[] data)

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

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

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

parseFrom(ByteString data)

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

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

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

parseFrom(CodedInputStream input)

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

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

parseFrom(InputStream input)

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

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

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

parseFrom(ByteBuffer data)

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

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

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

parser()

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

Methods

equals(Object obj)

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

getDefaultInstanceForType()

public NearestNeighborQuery getDefaultInstanceForType()
Returns
Type Description
NearestNeighborQuery

getEmbedding()

public NearestNeighborQuery.Embedding getEmbedding()

Optional. The embedding vector that be used for similar search.

.google.cloud.aiplatform.v1.NearestNeighborQuery.Embedding embedding = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
NearestNeighborQuery.Embedding

The embedding.

getEmbeddingOrBuilder()

public NearestNeighborQuery.EmbeddingOrBuilder getEmbeddingOrBuilder()

Optional. The embedding vector that be used for similar search.

.google.cloud.aiplatform.v1.NearestNeighborQuery.Embedding embedding = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
NearestNeighborQuery.EmbeddingOrBuilder

getEntityId()

public String getEntityId()

Optional. The entity id whose similar entities should be searched for. If embedding is set, search will use embedding instead of entity_id.

string entity_id = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
String

The entityId.

getEntityIdBytes()

public ByteString getEntityIdBytes()

Optional. The entity id whose similar entities should be searched for. If embedding is set, search will use embedding instead of entity_id.

string entity_id = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ByteString

The bytes for entityId.

getInstanceCase()

public NearestNeighborQuery.InstanceCase getInstanceCase()
Returns
Type Description
NearestNeighborQuery.InstanceCase

getNeighborCount()

public int getNeighborCount()

Optional. The number of similar entities to be retrieved from feature view for each query.

int32 neighbor_count = 3 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

The neighborCount.

getParameters()

public NearestNeighborQuery.Parameters getParameters()

Optional. Parameters that can be set to tune query on the fly.

.google.cloud.aiplatform.v1.NearestNeighborQuery.Parameters parameters = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
NearestNeighborQuery.Parameters

The parameters.

getParametersOrBuilder()

public NearestNeighborQuery.ParametersOrBuilder getParametersOrBuilder()

Optional. Parameters that can be set to tune query on the fly.

.google.cloud.aiplatform.v1.NearestNeighborQuery.Parameters parameters = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
NearestNeighborQuery.ParametersOrBuilder

getParserForType()

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

getPerCrowdingAttributeNeighborCount()

public int getPerCrowdingAttributeNeighborCount()

Optional. Crowding is a constraint on a neighbor list produced by nearest neighbor search requiring that no more than sper_crowding_attribute_neighbor_count of the k neighbors returned have the same value of crowding_attribute. It's used for improving result diversity.

int32 per_crowding_attribute_neighbor_count = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

The perCrowdingAttributeNeighborCount.

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

getStringFilters(int index)

public NearestNeighborQuery.StringFilter getStringFilters(int index)

Optional. The list of string filters.

repeated .google.cloud.aiplatform.v1.NearestNeighborQuery.StringFilter string_filters = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
NearestNeighborQuery.StringFilter

getStringFiltersCount()

public int getStringFiltersCount()

Optional. The list of string filters.

repeated .google.cloud.aiplatform.v1.NearestNeighborQuery.StringFilter string_filters = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

getStringFiltersList()

public List<NearestNeighborQuery.StringFilter> getStringFiltersList()

Optional. The list of string filters.

repeated .google.cloud.aiplatform.v1.NearestNeighborQuery.StringFilter string_filters = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<StringFilter>

getStringFiltersOrBuilder(int index)

public NearestNeighborQuery.StringFilterOrBuilder getStringFiltersOrBuilder(int index)

Optional. The list of string filters.

repeated .google.cloud.aiplatform.v1.NearestNeighborQuery.StringFilter string_filters = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int
Returns
Type Description
NearestNeighborQuery.StringFilterOrBuilder

getStringFiltersOrBuilderList()

public List<? extends NearestNeighborQuery.StringFilterOrBuilder> getStringFiltersOrBuilderList()

Optional. The list of string filters.

repeated .google.cloud.aiplatform.v1.NearestNeighborQuery.StringFilter string_filters = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
List<? extends com.google.cloud.aiplatform.v1.NearestNeighborQuery.StringFilterOrBuilder>

hasEmbedding()

public boolean hasEmbedding()

Optional. The embedding vector that be used for similar search.

.google.cloud.aiplatform.v1.NearestNeighborQuery.Embedding embedding = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the embedding field is set.

hasEntityId()

public boolean hasEntityId()

Optional. The entity id whose similar entities should be searched for. If embedding is set, search will use embedding instead of entity_id.

string entity_id = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the entityId field is set.

hasParameters()

public boolean hasParameters()

Optional. Parameters that can be set to tune query on the fly.

.google.cloud.aiplatform.v1.NearestNeighborQuery.Parameters parameters = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the parameters 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 NearestNeighborQuery.Builder newBuilderForType()
Returns
Type Description
NearestNeighborQuery.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

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

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

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

toBuilder()

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

writeTo(CodedOutputStream output)

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