pub struct AdaptiveIndex { /* private fields */ }Expand description
Adaptive index that automatically optimizes performance
Implementations§
Source§impl AdaptiveIndex
impl AdaptiveIndex
Sourcepub fn new(config: AdaptiveConfig) -> Self
pub fn new(config: AdaptiveConfig) -> Self
Create a new adaptive index
Sourcepub fn build(&mut self, embeddings: &HashMap<String, Vec<f32>>) -> Result<()>
pub fn build(&mut self, embeddings: &HashMap<String, Vec<f32>>) -> Result<()>
Build index from embeddings
Sourcepub fn search(&mut self, query: &[f32], k: usize) -> Result<Vec<SearchResult>>
pub fn search(&mut self, query: &[f32], k: usize) -> Result<Vec<SearchResult>>
Search for k nearest neighbors
Sourcepub fn add_vector(
&mut self,
entity_id: String,
embedding: Vec<f32>,
) -> Result<()>
pub fn add_vector( &mut self, entity_id: String, embedding: Vec<f32>, ) -> Result<()>
Add a single vector
Sourcepub fn add_vectors(
&mut self,
embeddings: &HashMap<String, Vec<f32>>,
) -> Result<()>
pub fn add_vectors( &mut self, embeddings: &HashMap<String, Vec<f32>>, ) -> Result<()>
Add multiple vectors
Sourcepub fn current_strategy(&self) -> SearchStrategy
pub fn current_strategy(&self) -> SearchStrategy
Get current search strategy
Sourcepub fn stats(&self) -> AdaptiveStats
pub fn stats(&self) -> AdaptiveStats
Get performance statistics
Auto Trait Implementations§
impl Freeze for AdaptiveIndex
impl RefUnwindSafe for AdaptiveIndex
impl Send for AdaptiveIndex
impl Sync for AdaptiveIndex
impl Unpin for AdaptiveIndex
impl UnwindSafe for AdaptiveIndex
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