pub struct AnnIndex { /* private fields */ }Expand description
Approximate nearest neighbor index using HNSW for large datasets, with brute-force fallback for small ones.
Vectors are stored in a FlatEmbeddings — one contiguous Arc<[f32]>
allocation — shared with the rest of the pipeline.
Implementations§
Source§impl AnnIndex
impl AnnIndex
Sourcepub fn build(embeddings: FlatEmbeddings) -> Self
pub fn build(embeddings: FlatEmbeddings) -> Self
Build the index from a FlatEmbeddings.
The corpus is shared via FlatEmbeddings.data (an Arc::clone, zero
bytes copied), so the cached HNSW index shares the same flat f32
allocation as the per-query aligned corpus.
Auto Trait Implementations§
impl Freeze for AnnIndex
impl RefUnwindSafe for AnnIndex
impl Send for AnnIndex
impl Sync for AnnIndex
impl Unpin for AnnIndex
impl UnsafeUnpin for AnnIndex
impl UnwindSafe for AnnIndex
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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>
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