Reference documentation and code samples for the Cloud Firestore V1 API class Google::Cloud::Firestore::V1::StructuredQuery::FindNearest.
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.
Inherits
- Object
Extended By
- Google::Protobuf::MessageExts::ClassMethods
Includes
- Google::Protobuf::MessageExts
Methods
#distance_measure
def distance_measure() -> ::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest::DistanceMeasure
- (::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest::DistanceMeasure) — Required. The distance measure to use, required.
#distance_measure=
def distance_measure=(value) -> ::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest::DistanceMeasure
- value (::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest::DistanceMeasure) — Required. The distance measure to use, required.
- (::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest::DistanceMeasure) — Required. The distance measure to use, required.
#distance_result_field
def distance_result_field() -> ::String
- (::String) — 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.
#distance_result_field=
def distance_result_field=(value) -> ::String
- value (::String) — 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) — 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.
#distance_threshold
def distance_threshold() -> ::Google::Protobuf::DoubleValue
-
(::Google::Protobuf::DoubleValue) — 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
#distance_threshold=
def distance_threshold=(value) -> ::Google::Protobuf::DoubleValue
-
value (::Google::Protobuf::DoubleValue) — 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) — 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
#limit
def limit() -> ::Google::Protobuf::Int32Value
- (::Google::Protobuf::Int32Value) — Required. The number of nearest neighbors to return. Must be a positive integer of no more than 1000.
#limit=
def limit=(value) -> ::Google::Protobuf::Int32Value
- value (::Google::Protobuf::Int32Value) — Required. The number of nearest neighbors to return. Must be a positive integer of no more than 1000.
- (::Google::Protobuf::Int32Value) — Required. The number of nearest neighbors to return. Must be a positive integer of no more than 1000.
#query_vector
def query_vector() -> ::Google::Cloud::Firestore::V1::Value
- (::Google::Cloud::Firestore::V1::Value) — Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions.
#query_vector=
def query_vector=(value) -> ::Google::Cloud::Firestore::V1::Value
- value (::Google::Cloud::Firestore::V1::Value) — Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions.
- (::Google::Cloud::Firestore::V1::Value) — Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions.
#vector_field
def vector_field() -> ::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference
- (::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference) — Required. An indexed vector field to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.
#vector_field=
def vector_field=(value) -> ::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference
- value (::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference) — Required. An indexed vector field to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.
- (::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference) — Required. An indexed vector field to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.