pub struct SearchResult {
pub vector_id: Arc<str>,
pub score: f32,
}Expand description
A single item returned by SearchBackend::search.
score is the cosine similarity between the query and the stored
vector. Values range from −1.0 to 1.0; higher is better. NaN
inputs are mapped to Equal in the Ord impl so that a stable sort
degrades gracefully rather than panicking.
Fields§
§vector_id: Arc<str>The identifier of the matching stored vector.
score: f32Cosine similarity score in [−1, 1]. Higher is better.
Trait Implementations§
Source§impl Clone for SearchResult
impl Clone for SearchResult
Source§fn clone(&self) -> SearchResult
fn clone(&self) -> SearchResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SearchResult
impl Debug for SearchResult
Source§impl Ord for SearchResult
impl Ord for SearchResult
Source§fn cmp(&self, other: &SearchResult) -> Ordering
fn cmp(&self, other: &SearchResult) -> Ordering
Descending by score (highest score sorts first).
NaN maps to Equal via unwrap_or so a stable sort degrades
gracefully rather than producing undefined behaviour. Vector id is
used as a tiebreaker (ascending) so that Ord agrees with PartialEq
— the contract requires a == b iff a.cmp(b) == Equal.
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for SearchResult
impl PartialEq for SearchResult
Source§impl PartialOrd for SearchResult
impl PartialOrd for SearchResult
impl Eq for SearchResult
Auto Trait Implementations§
impl Freeze for SearchResult
impl RefUnwindSafe for SearchResult
impl Send for SearchResult
impl Sync for SearchResult
impl Unpin for SearchResult
impl UnsafeUnpin for SearchResult
impl UnwindSafe for SearchResult
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<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§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
Compare self to
key and return true if they are equal.