pub trait VectorSearchEngine: Send + Sync {
// Required methods
fn add_vector(
&mut self,
memory_id: Uuid,
galaxy: Galaxy,
embedding: Vec<f32>,
);
fn remove_vector(&mut self, memory_id: Uuid) -> bool;
fn search_vectors(
&self,
query: &[f32],
limit: usize,
galaxy_filter: Option<Galaxy>,
) -> Vec<VectorSearchResult>;
fn search_similar_vectors(
&self,
memory_id: Uuid,
limit: usize,
) -> Vec<VectorSearchResult>;
fn vector_count(&self) -> usize;
fn load_vectors(&mut self, store: &MemoryStore) -> Result<()>;
fn clear_vectors(&mut self);
// Provided method
fn is_index_empty(&self) -> bool { ... }
}Expand description
Trait for pluggable vector search backends.
Implemented by:
VectorStore— in-memory brute-force cosine similarity (default)LanceVectorStore— LanceDB-backed ANN search (feature-gated underlancedb)
Required Methods§
Sourcefn add_vector(&mut self, memory_id: Uuid, galaxy: Galaxy, embedding: Vec<f32>)
fn add_vector(&mut self, memory_id: Uuid, galaxy: Galaxy, embedding: Vec<f32>)
Add a vector to the index.
Sourcefn remove_vector(&mut self, memory_id: Uuid) -> bool
fn remove_vector(&mut self, memory_id: Uuid) -> bool
Remove a vector from the index.
Sourcefn search_vectors(
&self,
query: &[f32],
limit: usize,
galaxy_filter: Option<Galaxy>,
) -> Vec<VectorSearchResult>
fn search_vectors( &self, query: &[f32], limit: usize, galaxy_filter: Option<Galaxy>, ) -> Vec<VectorSearchResult>
Search for the most similar vectors to a query embedding.
Returns results sorted by similarity (highest first). Optionally filter by galaxy.
Sourcefn search_similar_vectors(
&self,
memory_id: Uuid,
limit: usize,
) -> Vec<VectorSearchResult>
fn search_similar_vectors( &self, memory_id: Uuid, limit: usize, ) -> Vec<VectorSearchResult>
Search for similar vectors to a memory’s own embedding.
Excludes the memory itself from results.
Sourcefn vector_count(&self) -> usize
fn vector_count(&self) -> usize
Get the number of indexed vectors.
Sourcefn load_vectors(&mut self, store: &MemoryStore) -> Result<()>
fn load_vectors(&mut self, store: &MemoryStore) -> Result<()>
Load all embeddings from the LMDB Embeddings galaxy.
Sourcefn clear_vectors(&mut self)
fn clear_vectors(&mut self)
Clear the index.
Provided Methods§
Sourcefn is_index_empty(&self) -> bool
fn is_index_empty(&self) -> bool
Whether the index is empty.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".