Class FindNearest.Builder (2.24.3)

public static final class FindNearest.Builder extends GeneratedMessageV3.Builder<FindNearest.Builder> implements FindNearestOrBuilder

Nearest Neighbors search config. The ordering provided by FindNearest supersedes the order_by stage. If multiple documents have the same vector distance, the returned document order is not guaranteed to be stable between queries.

Protobuf type google.datastore.v1.FindNearest

Static Methods

getDescriptor()

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

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

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

build()

public FindNearest build()
Returns
Type Description
FindNearest

buildPartial()

public FindNearest buildPartial()
Returns
Type Description
FindNearest

clear()

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

clearDistanceMeasure()

public FindNearest.Builder clearDistanceMeasure()

Required. The Distance Measure to use, required.

.google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
FindNearest.Builder

This builder for chaining.

clearDistanceResultProperty()

public FindNearest.Builder clearDistanceResultProperty()

Optional. Optional name of the field to output the result of the vector distance calculation. Must conform to entity property limitations.

string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
FindNearest.Builder

This builder for chaining.

clearDistanceThreshold()

public FindNearest.Builder clearDistanceThreshold()

Optional. Option to specify a threshold for which no less similar documents will be returned. The behavior of the specified distance_measure will affect the meaning of the distance threshold. Since DOT_PRODUCT distances increase when the vectors are more similar, the comparison is inverted.

For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold For DOT_PRODUCT: WHERE distance >= distance_threshold

.google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
FindNearest.Builder

clearField(Descriptors.FieldDescriptor field)

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

clearLimit()

public FindNearest.Builder clearLimit()

Required. The number of nearest neighbors to return. Must be a positive integer of no more than 100.

.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
FindNearest.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

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

clearQueryVector()

public FindNearest.Builder clearQueryVector()

Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions.

.google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
FindNearest.Builder

clearVectorProperty()

public FindNearest.Builder clearVectorProperty()

Required. An indexed vector property to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.

.google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
FindNearest.Builder

clone()

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

getDefaultInstanceForType()

public FindNearest getDefaultInstanceForType()
Returns
Type Description
FindNearest

getDescriptorForType()

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

getDistanceMeasure()

public FindNearest.DistanceMeasure getDistanceMeasure()

Required. The Distance Measure to use, required.

.google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
FindNearest.DistanceMeasure

The distanceMeasure.

getDistanceMeasureValue()

public int getDistanceMeasureValue()

Required. The Distance Measure to use, required.

.google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
int

The enum numeric value on the wire for distanceMeasure.

getDistanceResultProperty()

public String getDistanceResultProperty()

Optional. Optional name of the field to output the result of the vector distance calculation. Must conform to entity property limitations.

string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
String

The distanceResultProperty.

getDistanceResultPropertyBytes()

public ByteString getDistanceResultPropertyBytes()

Optional. Optional name of the field to output the result of the vector distance calculation. Must conform to entity property limitations.

string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ByteString

The bytes for distanceResultProperty.

getDistanceThreshold()

public DoubleValue getDistanceThreshold()

Optional. Option to specify a threshold for which no less similar documents will be returned. The behavior of the specified distance_measure will affect the meaning of the distance threshold. Since DOT_PRODUCT distances increase when the vectors are more similar, the comparison is inverted.

For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold For DOT_PRODUCT: WHERE distance >= distance_threshold

.google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
DoubleValue

The distanceThreshold.

getDistanceThresholdBuilder()

public DoubleValue.Builder getDistanceThresholdBuilder()

Optional. Option to specify a threshold for which no less similar documents will be returned. The behavior of the specified distance_measure will affect the meaning of the distance threshold. Since DOT_PRODUCT distances increase when the vectors are more similar, the comparison is inverted.

For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold For DOT_PRODUCT: WHERE distance >= distance_threshold

.google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Builder

getDistanceThresholdOrBuilder()

public DoubleValueOrBuilder getDistanceThresholdOrBuilder()

Optional. Option to specify a threshold for which no less similar documents will be returned. The behavior of the specified distance_measure will affect the meaning of the distance threshold. Since DOT_PRODUCT distances increase when the vectors are more similar, the comparison is inverted.

For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold For DOT_PRODUCT: WHERE distance >= distance_threshold

.google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
DoubleValueOrBuilder

getLimit()

public Int32Value getLimit()

Required. The number of nearest neighbors to return. Must be a positive integer of no more than 100.

.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
Int32Value

The limit.

getLimitBuilder()

public Int32Value.Builder getLimitBuilder()

Required. The number of nearest neighbors to return. Must be a positive integer of no more than 100.

.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
Builder

getLimitOrBuilder()

public Int32ValueOrBuilder getLimitOrBuilder()

Required. The number of nearest neighbors to return. Must be a positive integer of no more than 100.

.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
Int32ValueOrBuilder

getQueryVector()

public Value getQueryVector()

Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions.

.google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
Value

The queryVector.

getQueryVectorBuilder()

public Value.Builder getQueryVectorBuilder()

Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions.

.google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
Value.Builder

getQueryVectorOrBuilder()

public ValueOrBuilder getQueryVectorOrBuilder()

Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions.

.google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
ValueOrBuilder

getVectorProperty()

public PropertyReference getVectorProperty()

Required. An indexed vector property to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.

.google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
PropertyReference

The vectorProperty.

getVectorPropertyBuilder()

public PropertyReference.Builder getVectorPropertyBuilder()

Required. An indexed vector property to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.

.google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
PropertyReference.Builder

getVectorPropertyOrBuilder()

public PropertyReferenceOrBuilder getVectorPropertyOrBuilder()

Required. An indexed vector property to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.

.google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
PropertyReferenceOrBuilder

hasDistanceThreshold()

public boolean hasDistanceThreshold()

Optional. Option to specify a threshold for which no less similar documents will be returned. The behavior of the specified distance_measure will affect the meaning of the distance threshold. Since DOT_PRODUCT distances increase when the vectors are more similar, the comparison is inverted.

For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold For DOT_PRODUCT: WHERE distance >= distance_threshold

.google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the distanceThreshold field is set.

hasLimit()

public boolean hasLimit()

Required. The number of nearest neighbors to return. Must be a positive integer of no more than 100.

.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
boolean

Whether the limit field is set.

hasQueryVector()

public boolean hasQueryVector()

Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions.

.google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
boolean

Whether the queryVector field is set.

hasVectorProperty()

public boolean hasVectorProperty()

Required. An indexed vector property to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.

.google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
boolean

Whether the vectorProperty field is set.

internalGetFieldAccessorTable()

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

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeDistanceThreshold(DoubleValue value)

public FindNearest.Builder mergeDistanceThreshold(DoubleValue value)

Optional. Option to specify a threshold for which no less similar documents will be returned. The behavior of the specified distance_measure will affect the meaning of the distance threshold. Since DOT_PRODUCT distances increase when the vectors are more similar, the comparison is inverted.

For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold For DOT_PRODUCT: WHERE distance >= distance_threshold

.google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value DoubleValue
Returns
Type Description
FindNearest.Builder

mergeFrom(FindNearest other)

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

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

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

mergeLimit(Int32Value value)

public FindNearest.Builder mergeLimit(Int32Value value)

Required. The number of nearest neighbors to return. Must be a positive integer of no more than 100.

.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
value Int32Value
Returns
Type Description
FindNearest.Builder

mergeQueryVector(Value value)

public FindNearest.Builder mergeQueryVector(Value value)

Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions.

.google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
value Value
Returns
Type Description
FindNearest.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

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

mergeVectorProperty(PropertyReference value)

public FindNearest.Builder mergeVectorProperty(PropertyReference value)

Required. An indexed vector property to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.

.google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
value PropertyReference
Returns
Type Description
FindNearest.Builder

setDistanceMeasure(FindNearest.DistanceMeasure value)

public FindNearest.Builder setDistanceMeasure(FindNearest.DistanceMeasure value)

Required. The Distance Measure to use, required.

.google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
value FindNearest.DistanceMeasure

The distanceMeasure to set.

Returns
Type Description
FindNearest.Builder

This builder for chaining.

setDistanceMeasureValue(int value)

public FindNearest.Builder setDistanceMeasureValue(int value)

Required. The Distance Measure to use, required.

.google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
value int

The enum numeric value on the wire for distanceMeasure to set.

Returns
Type Description
FindNearest.Builder

This builder for chaining.

setDistanceResultProperty(String value)

public FindNearest.Builder setDistanceResultProperty(String value)

Optional. Optional name of the field to output the result of the vector distance calculation. Must conform to entity property limitations.

string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value String

The distanceResultProperty to set.

Returns
Type Description
FindNearest.Builder

This builder for chaining.

setDistanceResultPropertyBytes(ByteString value)

public FindNearest.Builder setDistanceResultPropertyBytes(ByteString value)

Optional. Optional name of the field to output the result of the vector distance calculation. Must conform to entity property limitations.

string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value ByteString

The bytes for distanceResultProperty to set.

Returns
Type Description
FindNearest.Builder

This builder for chaining.

setDistanceThreshold(DoubleValue value)

public FindNearest.Builder setDistanceThreshold(DoubleValue value)

Optional. Option to specify a threshold for which no less similar documents will be returned. The behavior of the specified distance_measure will affect the meaning of the distance threshold. Since DOT_PRODUCT distances increase when the vectors are more similar, the comparison is inverted.

For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold For DOT_PRODUCT: WHERE distance >= distance_threshold

.google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value DoubleValue
Returns
Type Description
FindNearest.Builder

setDistanceThreshold(DoubleValue.Builder builderForValue)

public FindNearest.Builder setDistanceThreshold(DoubleValue.Builder builderForValue)

Optional. Option to specify a threshold for which no less similar documents will be returned. The behavior of the specified distance_measure will affect the meaning of the distance threshold. Since DOT_PRODUCT distances increase when the vectors are more similar, the comparison is inverted.

For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold For DOT_PRODUCT: WHERE distance >= distance_threshold

.google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
builderForValue Builder
Returns
Type Description
FindNearest.Builder

setField(Descriptors.FieldDescriptor field, Object value)

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

setLimit(Int32Value value)

public FindNearest.Builder setLimit(Int32Value value)

Required. The number of nearest neighbors to return. Must be a positive integer of no more than 100.

.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
value Int32Value
Returns
Type Description
FindNearest.Builder

setLimit(Int32Value.Builder builderForValue)

public FindNearest.Builder setLimit(Int32Value.Builder builderForValue)

Required. The number of nearest neighbors to return. Must be a positive integer of no more than 100.

.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
builderForValue Builder
Returns
Type Description
FindNearest.Builder

setQueryVector(Value value)

public FindNearest.Builder setQueryVector(Value value)

Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions.

.google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
value Value
Returns
Type Description
FindNearest.Builder

setQueryVector(Value.Builder builderForValue)

public FindNearest.Builder setQueryVector(Value.Builder builderForValue)

Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions.

.google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
builderForValue Value.Builder
Returns
Type Description
FindNearest.Builder

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

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

setUnknownFields(UnknownFieldSet unknownFields)

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

setVectorProperty(PropertyReference value)

public FindNearest.Builder setVectorProperty(PropertyReference value)

Required. An indexed vector property to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.

.google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
value PropertyReference
Returns
Type Description
FindNearest.Builder

setVectorProperty(PropertyReference.Builder builderForValue)

public FindNearest.Builder setVectorProperty(PropertyReference.Builder builderForValue)

Required. An indexed vector property to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.

.google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
builderForValue PropertyReference.Builder
Returns
Type Description
FindNearest.Builder