pub struct SqliteChunksStore { /* private fields */ }Expand description
SQLite-backed ChunksStore using FTS5 for BM25 ranking.
Implementations§
Source§impl SqliteChunksStore
impl SqliteChunksStore
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Open (or create) the chunks database at path.
Sourcepub fn open_in_memory() -> Result<Self>
pub fn open_in_memory() -> Result<Self>
Open an in-memory database — convenient for tests.
Sourcepub async fn upsert_vector(
&self,
chunk_id: ChunkId,
model_id: &str,
vec: &[f32],
) -> Result<()>
pub async fn upsert_vector( &self, chunk_id: ChunkId, model_id: &str, vec: &[f32], ) -> Result<()>
Store (or replace) the embedding vec for chunk_id, tagged with the
model_id that produced it (so a model change can be detected).
Sourcepub async fn vector_search(
&self,
project: Option<&str>,
query: &[f32],
k: usize,
) -> Result<Vec<ScoredChunk>>
pub async fn vector_search( &self, project: Option<&str>, query: &[f32], k: usize, ) -> Result<Vec<ScoredChunk>>
Brute-force cosine search over stored vectors (optionally scoped to a
project). Returns the top-k chunks by similarity to query. Vectors
whose dimension differs from query (a stale embedder) are skipped.
Sourcepub async fn count_vectors(&self) -> Result<usize>
pub async fn count_vectors(&self) -> Result<usize>
Count stored vectors (diagnostics / reindex decisions).
Trait Implementations§
Source§impl ChunksStore for SqliteChunksStore
impl ChunksStore for SqliteChunksStore
Source§fn append<'life0, 'async_trait>(
&'life0 self,
chunk: Chunk,
) -> Pin<Box<dyn Future<Output = Result<ChunkId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn append<'life0, 'async_trait>(
&'life0 self,
chunk: Chunk,
) -> Pin<Box<dyn Future<Output = Result<ChunkId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Append a new chunk.
Source§fn search_bm25<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: Option<&'life1 str>,
query: &'life2 str,
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<ScoredChunk>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn search_bm25<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: Option<&'life1 str>,
query: &'life2 str,
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<ScoredChunk>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
BM25 search. Read more
Source§impl Clone for SqliteChunksStore
impl Clone for SqliteChunksStore
Source§fn clone(&self) -> SqliteChunksStore
fn clone(&self) -> SqliteChunksStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SqliteChunksStore
impl RefUnwindSafe for SqliteChunksStore
impl Send for SqliteChunksStore
impl Sync for SqliteChunksStore
impl Unpin for SqliteChunksStore
impl UnsafeUnpin for SqliteChunksStore
impl UnwindSafe for SqliteChunksStore
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