Skip to main content

EmbeddingStore

Trait EmbeddingStore 

Source
pub trait EmbeddingStore: Send + Sync {
Show 13 methods // Required methods fn upsert(&self, chunks: &[EmbeddingChunk]) -> Result<usize>; fn insert(&self, chunks: &[EmbeddingChunk]) -> Result<usize>; fn search( &self, query_vec: &[f32], top_k: usize, ) -> Result<Vec<ScoredChunk>>; fn delete_by_file(&self, file_paths: &[&str]) -> Result<usize>; fn clear(&self) -> Result<()>; fn count(&self) -> Result<usize>; // Provided methods fn search_dual( &self, query_vec: &[f32], top_k: usize, doc_weight: f64, ) -> Result<Vec<ScoredChunk>> { ... } fn get_embedding( &self, _file_path: &str, _symbol_name: &str, ) -> Result<Option<EmbeddingChunk>> { ... } fn embeddings_for_scored_chunks( &self, chunks: &[ScoredChunk], ) -> Result<Vec<EmbeddingChunk>> { ... } fn all_with_embeddings(&self) -> Result<Vec<EmbeddingChunk>> { ... } fn embeddings_for_files( &self, file_paths: &[&str], ) -> Result<Vec<EmbeddingChunk>> { ... } fn for_each_embedding_batch( &self, batch_size: usize, visitor: &mut dyn FnMut(Vec<EmbeddingChunk>) -> Result<()>, ) -> Result<()> { ... } fn for_each_file_embeddings( &self, visitor: &mut dyn FnMut(String, Vec<EmbeddingChunk>) -> Result<()>, ) -> Result<()> { ... }
}
Expand description

Trait for vector embedding storage backends. Implementations handle persistence, indexing, and similarity search.

Required Methods§

Source

fn upsert(&self, chunks: &[EmbeddingChunk]) -> Result<usize>

Insert or update embedding chunks. Replaces ALL existing entries.

Source

fn insert(&self, chunks: &[EmbeddingChunk]) -> Result<usize>

Append embedding chunks without clearing existing data.

Source

fn search(&self, query_vec: &[f32], top_k: usize) -> Result<Vec<ScoredChunk>>

Search for chunks similar to the query embedding vector.

Source

fn delete_by_file(&self, file_paths: &[&str]) -> Result<usize>

Delete all embeddings for files matching the given paths.

Source

fn clear(&self) -> Result<()>

Clear all stored embeddings.

Source

fn count(&self) -> Result<usize>

Number of stored chunks.

Provided Methods§

Source

fn search_dual( &self, query_vec: &[f32], top_k: usize, doc_weight: f64, ) -> Result<Vec<ScoredChunk>>

Dual-vector search: blend code embedding score with doc embedding score. doc_weight controls the balance (0.0 = code only, 1.0 = doc only).

Source

fn get_embedding( &self, _file_path: &str, _symbol_name: &str, ) -> Result<Option<EmbeddingChunk>>

Retrieve a single stored chunk and embedding by symbol identity.

Source

fn embeddings_for_scored_chunks( &self, chunks: &[ScoredChunk], ) -> Result<Vec<EmbeddingChunk>>

Retrieve stored chunks matching previously ranked search results so callers can batch exact-vector follow-up work without per-result lookups.

Source

fn all_with_embeddings(&self) -> Result<Vec<EmbeddingChunk>>

Retrieve all stored chunks with their embeddings for batch analysis.

Source

fn embeddings_for_files( &self, file_paths: &[&str], ) -> Result<Vec<EmbeddingChunk>>

Retrieve stored chunks for the given files so incremental indexing can reuse unchanged embeddings without materializing the full index.

Source

fn for_each_embedding_batch( &self, batch_size: usize, visitor: &mut dyn FnMut(Vec<EmbeddingChunk>) -> Result<()>, ) -> Result<()>

Stream stored chunks in bounded batches so callers can avoid loading the entire embedding index into memory.

Source

fn for_each_file_embeddings( &self, visitor: &mut dyn FnMut(String, Vec<EmbeddingChunk>) -> Result<()>, ) -> Result<()>

Stream stored chunks grouped by file path for per-file analysis without requiring callers to materialize the entire index first. Full and incremental reindex reconciliation rely on this grouping.

Implementors§