Enum google_api_proto::google::firestore::v1::structured_query::find_nearest::DistanceMeasure
source · #[repr(i32)]pub enum DistanceMeasure {
Unspecified = 0,
Euclidean = 1,
Cosine = 2,
DotProduct = 3,
}
Expand description
The distance measure to use when comparing vectors.
Variants§
Unspecified = 0
Should not be set.
Euclidean = 1
Measures the EUCLIDEAN distance between the vectors. See Euclidean to learn more. The resulting distance decreases the more similar two vectors are.
Cosine = 2
COSINE distance compares vectors based on the angle between them, which allows you to measure similarity that isn’t based on the vectors magnitude. We recommend using DOT_PRODUCT with unit normalized vectors instead of COSINE distance, which is mathematically equivalent with better performance. See Cosine Similarity to learn more about COSINE similarity and COSINE distance. The resulting COSINE distance decreases the more similar two vectors are.
DotProduct = 3
Similar to cosine but is affected by the magnitude of the vectors. See Dot Product to learn more. The resulting distance increases the more similar two vectors are.
Implementations§
source§impl DistanceMeasure
impl DistanceMeasure
sourcepub fn as_str_name(&self) -> &'static str
pub fn as_str_name(&self) -> &'static str
String value of the enum field names used in the ProtoBuf definition.
The values are not transformed in any way and thus are considered stable (if the ProtoBuf definition does not change) and safe for programmatic use.
sourcepub fn from_str_name(value: &str) -> Option<Self>
pub fn from_str_name(value: &str) -> Option<Self>
Creates an enum from field names used in the ProtoBuf definition.
Trait Implementations§
source§impl Clone for DistanceMeasure
impl Clone for DistanceMeasure
source§fn clone(&self) -> DistanceMeasure
fn clone(&self) -> DistanceMeasure
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DistanceMeasure
impl Debug for DistanceMeasure
source§impl Default for DistanceMeasure
impl Default for DistanceMeasure
source§fn default() -> DistanceMeasure
fn default() -> DistanceMeasure
source§impl From<DistanceMeasure> for i32
impl From<DistanceMeasure> for i32
source§fn from(value: DistanceMeasure) -> i32
fn from(value: DistanceMeasure) -> i32
source§impl Hash for DistanceMeasure
impl Hash for DistanceMeasure
source§impl Ord for DistanceMeasure
impl Ord for DistanceMeasure
source§fn cmp(&self, other: &DistanceMeasure) -> Ordering
fn cmp(&self, other: &DistanceMeasure) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for DistanceMeasure
impl PartialEq for DistanceMeasure
source§fn eq(&self, other: &DistanceMeasure) -> bool
fn eq(&self, other: &DistanceMeasure) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for DistanceMeasure
impl PartialOrd for DistanceMeasure
source§fn partial_cmp(&self, other: &DistanceMeasure) -> Option<Ordering>
fn partial_cmp(&self, other: &DistanceMeasure) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl TryFrom<i32> for DistanceMeasure
impl TryFrom<i32> for DistanceMeasure
§type Error = UnknownEnumValue
type Error = UnknownEnumValue
source§fn try_from(value: i32) -> Result<DistanceMeasure, UnknownEnumValue>
fn try_from(value: i32) -> Result<DistanceMeasure, UnknownEnumValue>
impl Copy for DistanceMeasure
impl Eq for DistanceMeasure
impl StructuralPartialEq for DistanceMeasure
Auto Trait Implementations§
impl Freeze for DistanceMeasure
impl RefUnwindSafe for DistanceMeasure
impl Send for DistanceMeasure
impl Sync for DistanceMeasure
impl Unpin for DistanceMeasure
impl UnwindSafe for DistanceMeasure
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request