Class: Google::Apis::FirestoreV1beta1::FindNearest
- Inherits:
-
Object
- Object
- Google::Apis::FirestoreV1beta1::FindNearest
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- lib/google/apis/firestore_v1beta1/classes.rb,
lib/google/apis/firestore_v1beta1/representations.rb,
lib/google/apis/firestore_v1beta1/representations.rb
Overview
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.
Instance Attribute Summary collapse
-
#distance_measure ⇒ String
Required.
-
#distance_result_field ⇒ String
Optional.
-
#distance_threshold ⇒ Float
Optional.
-
#limit ⇒ Fixnum
Required.
-
#query_vector ⇒ Google::Apis::FirestoreV1beta1::Value
A message that can hold any of the supported value types.
-
#vector_field ⇒ Google::Apis::FirestoreV1beta1::FieldReference
A reference to a field in a document, ex:
stats.operations.
Instance Method Summary collapse
-
#initialize(**args) ⇒ FindNearest
constructor
A new instance of FindNearest.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ FindNearest
Returns a new instance of FindNearest.
1264 1265 1266 |
# File 'lib/google/apis/firestore_v1beta1/classes.rb', line 1264 def initialize(**args) update!(**args) end |
Instance Attribute Details
#distance_measure ⇒ String
Required. The distance measure to use, required.
Corresponds to the JSON property distanceMeasure
1230 1231 1232 |
# File 'lib/google/apis/firestore_v1beta1/classes.rb', line 1230 def distance_measure @distance_measure end |
#distance_result_field ⇒ String
Optional. Optional name of the field to output the result of the vector
distance calculation. Must conform to document field name limitations.
Corresponds to the JSON property distanceResultField
1236 1237 1238 |
# File 'lib/google/apis/firestore_v1beta1/classes.rb', line 1236 def distance_result_field @distance_result_field end |
#distance_threshold ⇒ Float
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
Corresponds to the JSON property distanceThreshold
1246 1247 1248 |
# File 'lib/google/apis/firestore_v1beta1/classes.rb', line 1246 def distance_threshold @distance_threshold end |
#limit ⇒ Fixnum
Required. The number of nearest neighbors to return. Must be a positive
integer of no more than 1000.
Corresponds to the JSON property limit
1252 1253 1254 |
# File 'lib/google/apis/firestore_v1beta1/classes.rb', line 1252 def limit @limit end |
#query_vector ⇒ Google::Apis::FirestoreV1beta1::Value
A message that can hold any of the supported value types.
Corresponds to the JSON property queryVector
1257 1258 1259 |
# File 'lib/google/apis/firestore_v1beta1/classes.rb', line 1257 def query_vector @query_vector end |
#vector_field ⇒ Google::Apis::FirestoreV1beta1::FieldReference
A reference to a field in a document, ex: stats.operations.
Corresponds to the JSON property vectorField
1262 1263 1264 |
# File 'lib/google/apis/firestore_v1beta1/classes.rb', line 1262 def vector_field @vector_field end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
1269 1270 1271 1272 1273 1274 1275 1276 |
# File 'lib/google/apis/firestore_v1beta1/classes.rb', line 1269 def update!(**args) @distance_measure = args[:distance_measure] if args.key?(:distance_measure) @distance_result_field = args[:distance_result_field] if args.key?(:distance_result_field) @distance_threshold = args[:distance_threshold] if args.key?(:distance_threshold) @limit = args[:limit] if args.key?(:limit) @query_vector = args[:query_vector] if args.key?(:query_vector) @vector_field = args[:vector_field] if args.key?(:vector_field) end |