Skip to main content

EmbeddingStore

Struct EmbeddingStore 

Source
pub struct EmbeddingStore { /* private fields */ }
Expand description

SQLite embedding store with FTS5 hybrid search

Implementations§

Source§

impl EmbeddingStore

Source

pub fn new_in_memory() -> SqlResult<Self>

Create a new embedding store (in-memory for testing)

Source

pub fn open(path: &Path) -> SqlResult<Self>

Open or create an embedding store from file

Source

pub fn insert_chunk( &mut self, chunk: &Chunk, embedding: &[f32], ) -> SqlResult<()>

Insert a chunk with its embedding

Source

pub fn get_chunk(&self, id: &str) -> SqlResult<Option<Chunk>>

Get a chunk by ID

Source

pub fn get_embedding(&self, chunk_id: &str) -> SqlResult<Option<Vec<f32>>>

Get embedding for a chunk

Source

pub fn search_keywords( &self, query: &str, limit: usize, ) -> SqlResult<Vec<ChunkMatch>>

FTS5 keyword search

Source

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)

Hybrid search: Combine FTS5 + vector similarity

Source

pub fn get_children(&self, parent_id: &str) -> SqlResult<Vec<Chunk>>

Get all child chunks of a parent

Source

pub fn count_chunks(&self) -> SqlResult<usize>

Count total chunks

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.