pub trait IndexBackend: Send + Sync {
// Required methods
fn insert(
&self,
entity_id: u64,
vector: &[f32],
timestamp: i64,
) -> Result<u32, IndexError>;
fn search(
&self,
query: &[f32],
k: usize,
filter: TemporalFilter,
alpha: f32,
query_timestamp: i64,
) -> Result<Vec<ScoredResult>, QueryError>;
fn remove(&self, point_id: u64) -> Result<(), IndexError>;
fn len(&self) -> usize;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
Index backend for approximate nearest neighbor search.
Abstracts over the indexing structure (HNSW, brute-force, etc.).
Required Methods§
Sourcefn insert(
&self,
entity_id: u64,
vector: &[f32],
timestamp: i64,
) -> Result<u32, IndexError>
fn insert( &self, entity_id: u64, vector: &[f32], timestamp: i64, ) -> Result<u32, IndexError>
Insert a point into the index.
Sourcefn search(
&self,
query: &[f32],
k: usize,
filter: TemporalFilter,
alpha: f32,
query_timestamp: i64,
) -> Result<Vec<ScoredResult>, QueryError>
fn search( &self, query: &[f32], k: usize, filter: TemporalFilter, alpha: f32, query_timestamp: i64, ) -> Result<Vec<ScoredResult>, QueryError>
Search for the k nearest neighbors with temporal filtering.
alpha controls the semantic vs temporal weight:
alpha = 1.0: pure semantic distancealpha = 0.0: pure temporal distance
query_timestamp is the reference time for temporal distance computation.