pub trait VectorIndex: Send + Sync {
// Required methods
fn upsert(&mut self, id: &str, embedding: &[f32]) -> Result<()>;
fn remove(&mut self, id: &str) -> Result<()>;
fn search(&self, query: &[f32], top_k: usize) -> Result<Vec<VectorHit>>;
fn save(&self, path: &Path) -> Result<()>;
fn len(&self) -> usize;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
Trait for vector indexing and similarity search.
Required Methods§
Sourcefn upsert(&mut self, id: &str, embedding: &[f32]) -> Result<()>
fn upsert(&mut self, id: &str, embedding: &[f32]) -> Result<()>
Add or update a vector in the index.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".