pub struct LazySegment { /* private fields */ }Expand description
Segment with lazy index construction
Implementations§
Source§impl LazySegment
impl LazySegment
Sourcepub fn new(vectors: Vec<(VectorKey, Vec<f32>)>, config: LazyConfig) -> Self
pub fn new(vectors: Vec<(VectorKey, Vec<f32>)>, config: LazyConfig) -> Self
Create a new lazy segment from vectors
Sourcepub fn from_flat(
flat_data: Vec<f32>,
keys: Vec<VectorKey>,
config: LazyConfig,
) -> Self
pub fn from_flat( flat_data: Vec<f32>, keys: Vec<VectorKey>, config: LazyConfig, ) -> Self
Create from flat data
Sourcepub fn get_by_index(&self, index: u32) -> Option<&[f32]>
pub fn get_by_index(&self, index: u32) -> Option<&[f32]>
Get vector by index
Sourcepub fn search(&self, query: &[f32], k: usize) -> Vec<(VectorKey, f32)>
pub fn search(&self, query: &[f32], k: usize) -> Vec<(VectorKey, f32)>
Search for k nearest neighbors
This will trigger index construction on first call.
Sourcepub fn indexes_built(&self) -> IndexStatus
pub fn indexes_built(&self) -> IndexStatus
Check if indexes are built
Sourcepub fn build_stats(&self) -> BuildStats
pub fn build_stats(&self) -> BuildStats
Get build statistics
Auto Trait Implementations§
impl !Freeze for LazySegment
impl RefUnwindSafe for LazySegment
impl Send for LazySegment
impl Sync for LazySegment
impl Unpin for LazySegment
impl UnsafeUnpin for LazySegment
impl UnwindSafe for LazySegment
Blanket Implementations§
impl<T> Allocation 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
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
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