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§
Source§impl<'de> Deserialize<'de> for Hit
impl<'de> Deserialize<'de> for Hit
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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