pub struct EmbeddingStore { /* private fields */ }Expand description
SQLite embedding store with FTS5 hybrid search
Implementations§
Source§impl EmbeddingStore
impl EmbeddingStore
Sourcepub fn new_in_memory() -> SqlResult<Self>
pub fn new_in_memory() -> SqlResult<Self>
Create a new embedding store (in-memory for testing)
Sourcepub fn insert_chunk(
&mut self,
chunk: &Chunk,
embedding: &[f32],
) -> SqlResult<()>
pub fn insert_chunk( &mut self, chunk: &Chunk, embedding: &[f32], ) -> SqlResult<()>
Insert a chunk with its embedding
Sourcepub fn get_embedding(&self, chunk_id: &str) -> SqlResult<Option<Vec<f32>>>
pub fn get_embedding(&self, chunk_id: &str) -> SqlResult<Option<Vec<f32>>>
Get embedding for a chunk
Sourcepub fn search_keywords(
&self,
query: &str,
limit: usize,
) -> SqlResult<Vec<ChunkMatch>>
pub fn search_keywords( &self, query: &str, limit: usize, ) -> SqlResult<Vec<ChunkMatch>>
FTS5 keyword search
Sourcepub fn search_similar(
&self,
query_embedding: &[f32],
limit: usize,
) -> SqlResult<Vec<ChunkMatch>>
pub fn search_similar( &self, query_embedding: &[f32], limit: usize, ) -> SqlResult<Vec<ChunkMatch>>
Vector similarity search (brute force for now, fast enough for <100K chunks)
Sourcepub fn hybrid_search(
&self,
keywords: &str,
query_embedding: &[f32],
limit: usize,
) -> SqlResult<Vec<ChunkMatch>>
pub fn hybrid_search( &self, keywords: &str, query_embedding: &[f32], limit: usize, ) -> SqlResult<Vec<ChunkMatch>>
Hybrid search: Combine FTS5 + vector similarity
Sourcepub fn get_children(&self, parent_id: &str) -> SqlResult<Vec<Chunk>>
pub fn get_children(&self, parent_id: &str) -> SqlResult<Vec<Chunk>>
Get all child chunks of a parent
Sourcepub fn count_chunks(&self) -> SqlResult<usize>
pub fn count_chunks(&self) -> SqlResult<usize>
Count total chunks
Auto Trait Implementations§
impl !Freeze for EmbeddingStore
impl !RefUnwindSafe for EmbeddingStore
impl Send for EmbeddingStore
impl !Sync for EmbeddingStore
impl Unpin for EmbeddingStore
impl !UnwindSafe for EmbeddingStore
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