Class FindNearest.Builder (2.28.2)

publicstaticfinalclass FindNearest.BuilderextendsGeneratedMessageV3.Builder<FindNearest.Builder>implementsFindNearestOrBuilder

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

Inherited Members

com.google.protobuf.GeneratedMessageV3.Builder.getUnknownFieldSetBuilder()
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMapFieldReflection(int)
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownLengthDelimitedField(int,com.google.protobuf.ByteString)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownVarintField(int,int)
com.google.protobuf.GeneratedMessageV3.Builder.parseUnknownField(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite,int)
com.google.protobuf.GeneratedMessageV3.Builder.setUnknownFieldSetBuilder(com.google.protobuf.UnknownFieldSet.Builder)

Static Methods

getDescriptor()

publicstaticfinalDescriptors.DescriptorgetDescriptor()
Returns
Type Description
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

publicFindNearest.BuilderaddRepeatedField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
FindNearest.Builder
Overrides

build()

publicFindNearestbuild()
Returns
Type Description
FindNearest

buildPartial()

publicFindNearestbuildPartial()
Returns
Type Description
FindNearest

clear()

publicFindNearest.Builderclear()
Returns
Type Description
FindNearest.Builder
Overrides

clearDistanceMeasure()

publicFindNearest.BuilderclearDistanceMeasure()

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()

publicFindNearest.BuilderclearDistanceResultProperty()

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()

publicFindNearest.BuilderclearDistanceThreshold()

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)

publicFindNearest.BuilderclearField(Descriptors.FieldDescriptorfield)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
FindNearest.Builder
Overrides

clearLimit()

publicFindNearest.BuilderclearLimit()

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)

publicFindNearest.BuilderclearOneof(Descriptors.OneofDescriptoroneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
FindNearest.Builder
Overrides

clearQueryVector()

publicFindNearest.BuilderclearQueryVector()

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()

publicFindNearest.BuilderclearVectorProperty()

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()

publicFindNearest.Builderclone()
Returns
Type Description
FindNearest.Builder
Overrides

getDefaultInstanceForType()

publicFindNearestgetDefaultInstanceForType()
Returns
Type Description
FindNearest

getDescriptorForType()

publicDescriptors.DescriptorgetDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getDistanceMeasure()

publicFindNearest.DistanceMeasuregetDistanceMeasure()

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()

publicintgetDistanceMeasureValue()

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()

publicStringgetDistanceResultProperty()

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()

publicByteStringgetDistanceResultPropertyBytes()

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()

publicDoubleValuegetDistanceThreshold()

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()

publicDoubleValue.BuildergetDistanceThresholdBuilder()

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()

publicDoubleValueOrBuildergetDistanceThresholdOrBuilder()

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()

publicInt32ValuegetLimit()

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()

publicInt32Value.BuildergetLimitBuilder()

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()

publicInt32ValueOrBuildergetLimitOrBuilder()

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()

publicValuegetQueryVector()

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()

publicValue.BuildergetQueryVectorBuilder()

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()

publicValueOrBuildergetQueryVectorOrBuilder()

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()

publicPropertyReferencegetVectorProperty()

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()

publicPropertyReference.BuildergetVectorPropertyBuilder()

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()

publicPropertyReferenceOrBuildergetVectorPropertyOrBuilder()

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()

publicbooleanhasDistanceThreshold()

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()

publicbooleanhasLimit()

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()

publicbooleanhasQueryVector()

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()

publicbooleanhasVectorProperty()

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()

protectedGeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

publicfinalbooleanisInitialized()
Returns
Type Description
boolean
Overrides

mergeDistanceThreshold(DoubleValue value)

publicFindNearest.BuildermergeDistanceThreshold(DoubleValuevalue)

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)

publicFindNearest.BuildermergeFrom(FindNearestother)
Parameter
Name Description
other FindNearest
Returns
Type Description
FindNearest.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

publicFindNearest.BuildermergeFrom(CodedInputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
FindNearest.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

publicFindNearest.BuildermergeFrom(Messageother)
Parameter
Name Description
other Message
Returns
Type Description
FindNearest.Builder
Overrides

mergeLimit(Int32Value value)

publicFindNearest.BuildermergeLimit(Int32Valuevalue)

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)

publicFindNearest.BuildermergeQueryVector(Valuevalue)

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)

publicfinalFindNearest.BuildermergeUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
FindNearest.Builder
Overrides

mergeVectorProperty(PropertyReference value)

publicFindNearest.BuildermergeVectorProperty(PropertyReferencevalue)

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)

publicFindNearest.BuildersetDistanceMeasure(FindNearest.DistanceMeasurevalue)

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)

publicFindNearest.BuildersetDistanceMeasureValue(intvalue)

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)

publicFindNearest.BuildersetDistanceResultProperty(Stringvalue)

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)

publicFindNearest.BuildersetDistanceResultPropertyBytes(ByteStringvalue)

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)

publicFindNearest.BuildersetDistanceThreshold(DoubleValuevalue)

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)

publicFindNearest.BuildersetDistanceThreshold(DoubleValue.BuilderbuilderForValue)

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)

publicFindNearest.BuildersetField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
FindNearest.Builder
Overrides

setLimit(Int32Value value)

publicFindNearest.BuildersetLimit(Int32Valuevalue)

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)

publicFindNearest.BuildersetLimit(Int32Value.BuilderbuilderForValue)

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)

publicFindNearest.BuildersetQueryVector(Valuevalue)

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)

publicFindNearest.BuildersetQueryVector(Value.BuilderbuilderForValue)

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)

publicFindNearest.BuildersetRepeatedField(Descriptors.FieldDescriptorfield,intindex,Objectvalue)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
FindNearest.Builder
Overrides

setUnknownFields(UnknownFieldSet unknownFields)

publicfinalFindNearest.BuildersetUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
FindNearest.Builder
Overrides

setVectorProperty(PropertyReference value)

publicFindNearest.BuildersetVectorProperty(PropertyReferencevalue)

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)

publicFindNearest.BuildersetVectorProperty(PropertyReference.BuilderbuilderForValue)

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

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月19日 UTC.