DistanceMeasure enum

The distance measure used by a nearest-neighbour (vector) query.

Pass it to Query.findNearest. Use the measure the vector index of the field was created with.

firestore
    .collection('items')
    .findNearest('embedding', <double>[0.1, 0.2], 3, DistanceMeasure.dotProduct);
Inheritance
Available extensions

Values

euclidean → const DistanceMeasure

Measures the euclidean distance between the vectors. Smaller is closer.

cosine → const DistanceMeasure

Compares vectors based on the angle between them, which allows you to measure similarity that is not influenced by the magnitude of the vectors. The cosine distance: smaller is closer.

dotProduct → const DistanceMeasure

Similar to cosine but is affected by the magnitude of the vectors. The dot product is a similarity: larger is closer.

Properties

hashCode → int
The hash code for this object.
no setterinherited
index → int
A numeric identifier for the enumerated value.
no setterinherited
name → String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

values → const List<DistanceMeasure>
A constant List of the values in this enum, in order of their declaration.