pub struct VectorStore { /* private fields */ }Expand description
Vector store backed by SQLite.
Implementations§
Source§impl VectorStore
impl VectorStore
Sourcepub fn open(db_path: &Path) -> DbResult<Self>
pub fn open(db_path: &Path) -> DbResult<Self>
Open or create a vector store at the given database path. Creates the embeddings table if it doesn’t exist.
Sourcepub fn from_connection(conn: Connection) -> Self
pub fn from_connection(conn: Connection) -> Self
Open a vector store using an existing connection (for project DBs that already have the embeddings table via migration).
Sourcepub fn store_embedding(
&self,
file_path: &str,
chunk_text: &str,
embedding: &[f32],
) -> DbResult<()>
pub fn store_embedding( &self, file_path: &str, chunk_text: &str, embedding: &[f32], ) -> DbResult<()>
Store an embedding for a file chunk. Replaces if already exists.
Sourcepub fn search_similar(
&self,
query_embedding: &[f32],
limit: usize,
) -> DbResult<Vec<SemanticResult>>
pub fn search_similar( &self, query_embedding: &[f32], limit: usize, ) -> DbResult<Vec<SemanticResult>>
Search for the most similar embeddings to the query vector.
Sourcepub fn clear_embeddings(&self) -> DbResult<()>
pub fn clear_embeddings(&self) -> DbResult<()>
Clear all stored embeddings.
Sourcepub fn get_embedding_count(&self) -> DbResult<usize>
pub fn get_embedding_count(&self) -> DbResult<usize>
Get the total count of stored embeddings.
Sourcepub fn get_indexed_file_count(&self) -> DbResult<usize>
pub fn get_indexed_file_count(&self) -> DbResult<usize>
Get the number of unique files with embeddings.
Sourcepub fn delete_file_embeddings(&self, file_path: &str) -> DbResult<()>
pub fn delete_file_embeddings(&self, file_path: &str) -> DbResult<()>
Delete all embeddings for a specific file.
Auto Trait Implementations§
impl !Freeze for VectorStore
impl !RefUnwindSafe for VectorStore
impl Send for VectorStore
impl !Sync for VectorStore
impl Unpin for VectorStore
impl UnsafeUnpin for VectorStore
impl !UnwindSafe for VectorStore
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more