pub enum CosineComparison {
Comparable(f32),
DimensionMismatch {
query_dim: usize,
stored_dim: usize,
},
}Expand description
v0.7.0 H7 — dimension-aware outcome of a recall-time cosine comparison between a live query embedding and a stored embedding whose producing model may have changed since the row was written.
Embedder::cosine_similarity collapses a dimension mismatch to 0.0,
which is numerically indistinguishable from a genuinely orthogonal pair.
That makes an embedder-model switch silent: every legacy-dimension row
scores 0.0 on the semantic axis and quietly drops out of the ranking
with no operator-visible signal. This enum preserves the same 0.0
numerical fallback at the call site but lets recall count and surface
the mismatch instead of swallowing it.
Variants§
Comparable(f32)
Both vectors share dimensionality; carries the cosine score.
DimensionMismatch
Stored embedding dimensionality differs from the query’s — almost always the result of a different embedder model. Carries both dimensions so callers can report which model produced what.
Trait Implementations§
Source§impl Clone for CosineComparison
impl Clone for CosineComparison
Source§fn clone(&self) -> CosineComparison
fn clone(&self) -> CosineComparison
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CosineComparison
Source§impl Debug for CosineComparison
impl Debug for CosineComparison
Source§impl PartialEq for CosineComparison
impl PartialEq for CosineComparison
Source§fn eq(&self, other: &CosineComparison) -> bool
fn eq(&self, other: &CosineComparison) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CosineComparison
Auto Trait Implementations§
impl Freeze for CosineComparison
impl RefUnwindSafe for CosineComparison
impl Send for CosineComparison
impl Sync for CosineComparison
impl Unpin for CosineComparison
impl UnsafeUnpin for CosineComparison
impl UnwindSafe for CosineComparison
Blanket Implementations§
impl<T> Boilerplate for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more