Class: Google::Apis::DatastoreV1beta3::FindNearest
- Inherits:
-
Object
- Object
- Google::Apis::DatastoreV1beta3::FindNearest
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- lib/google/apis/datastore_v1beta3/classes.rb,
lib/google/apis/datastore_v1beta3/representations.rb,
lib/google/apis/datastore_v1beta3/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_property ⇒ String
Optional.
-
#distance_threshold ⇒ Float
Optional.
-
#limit ⇒ Fixnum
Required.
-
#query_vector ⇒ Google::Apis::DatastoreV1beta3::Value
A message that can hold any of the supported value types and associated metadata.
-
#vector_property ⇒ Google::Apis::DatastoreV1beta3::PropertyReference
A reference to a property relative to the kind expressions.
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.
659 660 661 |
# File 'lib/google/apis/datastore_v1beta3/classes.rb', line 659 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
624 625 626 |
# File 'lib/google/apis/datastore_v1beta3/classes.rb', line 624 def distance_measure @distance_measure end |
#distance_result_property ⇒ String
Optional. Optional name of the field to output the result of the vector
distance calculation. Must conform to entity property limitations.
Corresponds to the JSON property distanceResultProperty
630 631 632 |
# File 'lib/google/apis/datastore_v1beta3/classes.rb', line 630 def distance_result_property @distance_result_property 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
640 641 642 |
# File 'lib/google/apis/datastore_v1beta3/classes.rb', line 640 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 100.
Corresponds to the JSON property limit
646 647 648 |
# File 'lib/google/apis/datastore_v1beta3/classes.rb', line 646 def limit @limit end |
#query_vector ⇒ Google::Apis::DatastoreV1beta3::Value
A message that can hold any of the supported value types and associated
metadata.
Corresponds to the JSON property queryVector
652 653 654 |
# File 'lib/google/apis/datastore_v1beta3/classes.rb', line 652 def query_vector @query_vector end |
#vector_property ⇒ Google::Apis::DatastoreV1beta3::PropertyReference
A reference to a property relative to the kind expressions.
Corresponds to the JSON property vectorProperty
657 658 659 |
# File 'lib/google/apis/datastore_v1beta3/classes.rb', line 657 def vector_property @vector_property end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
664 665 666 667 668 669 670 671 |
# File 'lib/google/apis/datastore_v1beta3/classes.rb', line 664 def update!(**args) @distance_measure = args[:distance_measure] if args.key?(:distance_measure) @distance_result_property = args[:distance_result_property] if args.key?(:distance_result_property) @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_property = args[:vector_property] if args.key?(:vector_property) end |