pub struct HnswIndex { /* private fields */ }Expand description
HNSW index wrapper
Implementations§
Source§impl HnswIndex
impl HnswIndex
Sourcepub fn new(
dimensions: usize,
metric: DistanceMetric,
config: HnswConfig,
) -> Result<Self>
pub fn new( dimensions: usize, metric: DistanceMetric, config: HnswConfig, ) -> Result<Self>
Create a new HNSW index
Sourcepub fn config(&self) -> &HnswConfig
pub fn config(&self) -> &HnswConfig
Get configuration
Sourcepub fn set_ef_search(&mut self, _ef_search: usize)
pub fn set_ef_search(&mut self, _ef_search: usize)
Set efSearch parameter for query-time accuracy tuning
Sourcepub fn deserialize(bytes: &[u8]) -> Result<Self>
pub fn deserialize(bytes: &[u8]) -> Result<Self>
Deserialize the index from bytes using bincode
Sourcepub fn search_with_ef(
&self,
query: &[f32],
k: usize,
ef_search: usize,
) -> Result<Vec<SearchResult>>
pub fn search_with_ef( &self, query: &[f32], k: usize, ef_search: usize, ) -> Result<Vec<SearchResult>>
Search with custom efSearch parameter
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HnswIndex
impl !RefUnwindSafe for HnswIndex
impl Send for HnswIndex
impl Sync for HnswIndex
impl Unpin for HnswIndex
impl !UnwindSafe for HnswIndex
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> 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