Class StructuredQuery.FindNearest

java.lang.Object
com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessage
com.google.protobuf.GeneratedMessageV3
com.google.firestore.v1.StructuredQuery.FindNearest
All Implemented Interfaces:
StructuredQuery.FindNearestOrBuilder, com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Serializable
Enclosing class:
StructuredQuery

public static final class StructuredQuery.FindNearest extends com.google.protobuf.GeneratedMessageV3 implements StructuredQuery.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.firestore.v1.StructuredQuery.FindNearest
See Also:
  • Field Details

    • VECTOR_FIELD_FIELD_NUMBER

      public static final int VECTOR_FIELD_FIELD_NUMBER
      See Also:
    • QUERY_VECTOR_FIELD_NUMBER

      public static final int QUERY_VECTOR_FIELD_NUMBER
      See Also:
    • DISTANCE_MEASURE_FIELD_NUMBER

      public static final int DISTANCE_MEASURE_FIELD_NUMBER
      See Also:
    • LIMIT_FIELD_NUMBER

      public static final int LIMIT_FIELD_NUMBER
      See Also:
    • DISTANCE_RESULT_FIELD_FIELD_NUMBER

      public static final int DISTANCE_RESULT_FIELD_FIELD_NUMBER
      See Also:
    • DISTANCE_THRESHOLD_FIELD_NUMBER

      public static final int DISTANCE_THRESHOLD_FIELD_NUMBER
      See Also:
  • Method Details

    • newInstance

      protected Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
      Overrides:
      newInstance in class com.google.protobuf.GeneratedMessageV3
    • getDescriptor

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3
    • hasVectorField

      public boolean hasVectorField()
       Required. An indexed vector field to search upon. Only documents which
       contain vectors whose dimensionality match the query_vector can be
       returned.
       
      .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      hasVectorField in interface StructuredQuery.FindNearestOrBuilder
      Returns:
      Whether the vectorField field is set.
    • getVectorField

      public StructuredQuery.FieldReference getVectorField()
       Required. An indexed vector field to search upon. Only documents which
       contain vectors whose dimensionality match the query_vector can be
       returned.
       
      .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      getVectorField in interface StructuredQuery.FindNearestOrBuilder
      Returns:
      The vectorField.
    • getVectorFieldOrBuilder

      public StructuredQuery.FieldReferenceOrBuilder getVectorFieldOrBuilder()
       Required. An indexed vector field to search upon. Only documents which
       contain vectors whose dimensionality match the query_vector can be
       returned.
       
      .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      getVectorFieldOrBuilder in interface StructuredQuery.FindNearestOrBuilder
    • hasQueryVector

      public boolean hasQueryVector()
       Required. The query vector that we are searching on. Must be a vector of
       no more than 2048 dimensions.
       
      .google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      hasQueryVector in interface StructuredQuery.FindNearestOrBuilder
      Returns:
      Whether the queryVector field is set.
    • getQueryVector

      public Value getQueryVector()
       Required. The query vector that we are searching on. Must be a vector of
       no more than 2048 dimensions.
       
      .google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      getQueryVector in interface StructuredQuery.FindNearestOrBuilder
      Returns:
      The queryVector.
    • getQueryVectorOrBuilder

      public ValueOrBuilder getQueryVectorOrBuilder()
       Required. The query vector that we are searching on. Must be a vector of
       no more than 2048 dimensions.
       
      .google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      getQueryVectorOrBuilder in interface StructuredQuery.FindNearestOrBuilder
    • getDistanceMeasureValue

      public int getDistanceMeasureValue()
       Required. The distance measure to use, required.
       
      .google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      getDistanceMeasureValue in interface StructuredQuery.FindNearestOrBuilder
      Returns:
      The enum numeric value on the wire for distanceMeasure.
    • getDistanceMeasure

      public StructuredQuery.FindNearest.DistanceMeasure getDistanceMeasure()
       Required. The distance measure to use, required.
       
      .google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      getDistanceMeasure in interface StructuredQuery.FindNearestOrBuilder
      Returns:
      The distanceMeasure.
    • hasLimit

      public boolean hasLimit()
       Required. The number of nearest neighbors to return. Must be a positive
       integer of no more than 1000.
       
      .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      hasLimit in interface StructuredQuery.FindNearestOrBuilder
      Returns:
      Whether the limit field is set.
    • getLimit

      public com.google.protobuf.Int32Value getLimit()
       Required. The number of nearest neighbors to return. Must be a positive
       integer of no more than 1000.
       
      .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      getLimit in interface StructuredQuery.FindNearestOrBuilder
      Returns:
      The limit.
    • getLimitOrBuilder

      public com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder()
       Required. The number of nearest neighbors to return. Must be a positive
       integer of no more than 1000.
       
      .google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      getLimitOrBuilder in interface StructuredQuery.FindNearestOrBuilder
    • getDistanceResultField

      public String getDistanceResultField()
       Optional. Optional name of the field to output the result of the vector
       distance calculation. Must conform to [document field
       name][google.firestore.v1.Document.fields] limitations.
       
      string distance_result_field = 5 [(.google.api.field_behavior) = OPTIONAL];
      Specified by:
      getDistanceResultField in interface StructuredQuery.FindNearestOrBuilder
      Returns:
      The distanceResultField.
    • getDistanceResultFieldBytes

      public com.google.protobuf.ByteString getDistanceResultFieldBytes()
       Optional. Optional name of the field to output the result of the vector
       distance calculation. Must conform to [document field
       name][google.firestore.v1.Document.fields] limitations.
       
      string distance_result_field = 5 [(.google.api.field_behavior) = OPTIONAL];
      Specified by:
      getDistanceResultFieldBytes in interface StructuredQuery.FindNearestOrBuilder
      Returns:
      The bytes for distanceResultField.
    • 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];
      Specified by:
      hasDistanceThreshold in interface StructuredQuery.FindNearestOrBuilder
      Returns:
      Whether the distanceThreshold field is set.
    • getDistanceThreshold

      public com.google.protobuf.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];
      Specified by:
      getDistanceThreshold in interface StructuredQuery.FindNearestOrBuilder
      Returns:
      The distanceThreshold.
    • getDistanceThresholdOrBuilder

      public com.google.protobuf.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];
      Specified by:
      getDistanceThresholdOrBuilder in interface StructuredQuery.FindNearestOrBuilder
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessageV3
    • writeTo

      public void writeTo(com.google.protobuf.CodedOutputStream output) throws IOException
      Specified by:
      writeTo in interface com.google.protobuf.MessageLite
      Overrides:
      writeTo in class com.google.protobuf.GeneratedMessageV3
      Throws:
      IOException
    • getSerializedSize

      public int getSerializedSize()
      Specified by:
      getSerializedSize in interface com.google.protobuf.MessageLite
      Overrides:
      getSerializedSize in class com.google.protobuf.GeneratedMessageV3
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface com.google.protobuf.Message
      Overrides:
      equals in class com.google.protobuf.AbstractMessage
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface com.google.protobuf.Message
      Overrides:
      hashCode in class com.google.protobuf.AbstractMessage
    • parseFrom

      public static StructuredQuery.FindNearest parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StructuredQuery.FindNearest parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StructuredQuery.FindNearest parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StructuredQuery.FindNearest parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StructuredQuery.FindNearest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StructuredQuery.FindNearest parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StructuredQuery.FindNearest parseFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static StructuredQuery.FindNearest parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static StructuredQuery.FindNearest parseDelimitedFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static StructuredQuery.FindNearest parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseFrom

      public static StructuredQuery.FindNearest parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static StructuredQuery.FindNearest parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • newBuilderForType

      public StructuredQuery.FindNearest.Builder newBuilderForType()
      Specified by:
      newBuilderForType in interface com.google.protobuf.Message
      Specified by:
      newBuilderForType in interface com.google.protobuf.MessageLite
    • newBuilder

      public static StructuredQuery.FindNearest.Builder newBuilder()
    • newBuilder

    • toBuilder

      Specified by:
      toBuilder in interface com.google.protobuf.Message
      Specified by:
      toBuilder in interface com.google.protobuf.MessageLite
    • newBuilderForType

      protected StructuredQuery.FindNearest.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
      Specified by:
      newBuilderForType in class com.google.protobuf.GeneratedMessageV3
    • getDefaultInstance

      public static StructuredQuery.FindNearest getDefaultInstance()
    • parser

      public static com.google.protobuf.Parser<StructuredQuery.FindNearest> parser()
    • getParserForType

      public com.google.protobuf.Parser<StructuredQuery.FindNearest> getParserForType()
      Specified by:
      getParserForType in interface com.google.protobuf.Message
      Specified by:
      getParserForType in interface com.google.protobuf.MessageLite
      Overrides:
      getParserForType in class com.google.protobuf.GeneratedMessageV3
    • getDefaultInstanceForType

      public StructuredQuery.FindNearest getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder