pub trait VectorStore: Send + Sync {
// Required methods
async fn add(&self, document: Document) -> Result<()>;
async fn add_batch(&self, documents: Vec<Document>) -> Result<()>;
async fn search(
&self,
query: &[f32],
top_k: usize,
) -> Result<Vec<Similarity>>;
async fn search_with_filter(
&self,
query: &[f32],
top_k: usize,
filter: &MetadataFilter,
) -> Result<Vec<Similarity>>;
async fn search_batch(
&self,
queries: &[Vec<f32>],
top_k: usize,
) -> Result<Vec<Vec<Similarity>>>;
async fn get(&self, id: &str) -> Result<Option<Document>>;
async fn delete(&self, id: &str) -> Result<bool>;
async fn delete_batch(&self, ids: Vec<String>) -> Result<usize>;
async fn clear(&self) -> Result<()>;
async fn list(&self, limit: usize, offset: usize) -> Result<Vec<Document>>;
async fn count(&self) -> Result<usize>;
fn metric(&self) -> DistanceMetric;
}Required Methods§
async fn add(&self, document: Document) -> Result<()>
async fn add_batch(&self, documents: Vec<Document>) -> Result<()>
async fn search(&self, query: &[f32], top_k: usize) -> Result<Vec<Similarity>>
async fn search_with_filter( &self, query: &[f32], top_k: usize, filter: &MetadataFilter, ) -> Result<Vec<Similarity>>
async fn search_batch( &self, queries: &[Vec<f32>], top_k: usize, ) -> Result<Vec<Vec<Similarity>>>
async fn get(&self, id: &str) -> Result<Option<Document>>
async fn delete(&self, id: &str) -> Result<bool>
async fn delete_batch(&self, ids: Vec<String>) -> Result<usize>
async fn clear(&self) -> Result<()>
async fn list(&self, limit: usize, offset: usize) -> Result<Vec<Document>>
async fn count(&self) -> Result<usize>
fn metric(&self) -> DistanceMetric
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".