pub struct Hit {
pub id: VectorId,
pub distance: f32,
pub metadata: Option<Metadata>,
}Expand description
One result of a similarity search: a matched record and its distance.
id identifies the matched vector, distance is its distance from the
query under the search’s metric (smaller is nearer), and metadata is the
record’s metadata when the engine was asked to return it. Build a bare hit
with Hit::new and attach metadata by setting the field.
§Examples
use iqdb_types::{Hit, VectorId};
let hit = Hit::new(VectorId::from(42u64), 0.125);
assert_eq!(hit.id, VectorId::U64(42));
assert_eq!(hit.distance, 0.125);
assert!(hit.metadata.is_none());Fields§
§id: VectorIdThe identifier of the matched vector.
distance: f32The distance from the query under the search’s metric (smaller is nearer).
metadata: Option<Metadata>The record’s metadata, when the search was asked to return it.
Implementations§
Trait Implementations§
impl StructuralPartialEq for Hit
Auto Trait Implementations§
impl Freeze for Hit
impl RefUnwindSafe for Hit
impl Send for Hit
impl Sync for Hit
impl Unpin for Hit
impl UnsafeUnpin for Hit
impl UnwindSafe for Hit
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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