pub trait ANNIndexOwned<const N: usize> {
// Required methods
fn insert_with_rng(
&mut self,
vector: Vector<N>,
id: String,
rng: &mut impl Rng,
);
fn delete_by_id(&mut self, id: &str) -> bool;
fn get_by_id(&self, id: &str) -> Option<&Vector<N>>;
fn search_with_metric(
&self,
query: &Vector<N>,
top_k: usize,
metric: ScoreMetric,
) -> Vec<(String, f32)>;
// Provided methods
fn insert(&mut self, vector: Vector<N>, id: String) { ... }
fn search(&self, query: &Vector<N>, top_k: usize) -> Vec<(String, f32)> { ... }
}
Required Methods§
Sourcefn insert_with_rng(&mut self, vector: Vector<N>, id: String, rng: &mut impl Rng)
fn insert_with_rng(&mut self, vector: Vector<N>, id: String, rng: &mut impl Rng)
Insert a vector into the index with a custom rng.
Sourcefn delete_by_id(&mut self, id: &str) -> bool
fn delete_by_id(&mut self, id: &str) -> bool
Delete a vector from the index by id. Returns true if the vector was deleted, false if it was not found.
Sourcefn search_with_metric(
&self,
query: &Vector<N>,
top_k: usize,
metric: ScoreMetric,
) -> Vec<(String, f32)>
fn search_with_metric( &self, query: &Vector<N>, top_k: usize, metric: ScoreMetric, ) -> Vec<(String, f32)>
Search for the top_k nearest neighbors of the query vector. Returns a array of (id, score) pairs, higher score means closer.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.