pub struct IndexManager {
pub hnsw: HnswIndex,
pub bitmap: BitmapIndex,
pub temporal: TemporalIndex,
pub salience: SalienceIndex,
}Expand description
Owns all index types and provides unified indexing and hybrid search.
Fields§
§hnsw: HnswIndex§bitmap: BitmapIndex§temporal: TemporalIndex§salience: SalienceIndexImplementations§
Source§impl IndexManager
impl IndexManager
Sourcepub fn new(config: IndexManagerConfig) -> Self
pub fn new(config: IndexManagerConfig) -> Self
Create a new index manager with the given configuration.
Sourcepub fn save(&self, dir: &Path) -> MenteResult<()>
pub fn save(&self, dir: &Path) -> MenteResult<()>
Save all indexes to the given directory.
Sourcepub fn load(dir: &Path) -> MenteResult<Self>
pub fn load(dir: &Path) -> MenteResult<Self>
Load all indexes from the given directory.
Sourcepub fn index_memory(&self, node: &MemoryNode)
pub fn index_memory(&self, node: &MemoryNode)
Index a memory node across all indexes.
Sourcepub fn remove_memory(&self, id: MemoryId, node: &MemoryNode)
pub fn remove_memory(&self, id: MemoryId, node: &MemoryNode)
Remove a memory from all indexes.
Sourcepub fn hybrid_search(
&self,
query_embedding: &[f32],
tags: Option<&[&str]>,
time_range: Option<(Timestamp, Timestamp)>,
k: usize,
) -> Vec<(MemoryId, f32)>
pub fn hybrid_search( &self, query_embedding: &[f32], tags: Option<&[&str]>, time_range: Option<(Timestamp, Timestamp)>, k: usize, ) -> Vec<(MemoryId, f32)>
Hybrid search combining vector similarity, tag filtering, time range, and salience.
Strategy:
- Vector search to get top k*4 candidates
- Filter by tags (if provided) and time range (if provided)
- Re-rank by combined score: vector_sim * 0.6 + salience * 0.3 + recency * 0.1
- Return top k results
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for IndexManager
impl !RefUnwindSafe for IndexManager
impl Send for IndexManager
impl Sync for IndexManager
impl Unpin for IndexManager
impl UnsafeUnpin for IndexManager
impl UnwindSafe for IndexManager
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