Index Overview
All three indices are embedded directly in the
.mv2 file. No external dependencies or sidecar files.
Lexical Index
The lexical index powers fast, precise keyword search using BM25, a proven ranking algorithm for full-text search.How It Works
- BM25 ranking: Scores documents by term frequency and inverse document frequency
- Tokenization: Breaks text into searchable terms
- Memory-mapped: Uses mmap for efficient disk access
- Embedded: Stored as a snapshot inside the
.mv2file
When to Use
Lexical search excels at finding exact matches:Building the Index
The lexical index is built automatically when you add documents. You can also rebuild it:Disabling Lexical Index
For vector-only workloads, you can disable lexical indexing:Vector Index
The vector index enables semantic search, finding documents by meaning rather than exact keywords.How It Works
- Embeddings: Documents are converted to dense vectors (default: BGE-small, 384 dimensions)
- External providers: Support for OpenAI, Cohere, Voyage, and HuggingFace models
- Vector graph: Fast approximate nearest neighbor search for semantic similarity
- Product Quantization (PQ): Optional 16x compression for large collections
- Embedded: Stored as segments inside the
.mv2file
Embedding Model Options
See Embedding Models for detailed configuration.
When to Use
Vector search excels at understanding intent:Building the Index
Enable embeddings when adding documents:Rebuilding the Index
If vector search isn’t working correctly:Direct Vector Search
For custom embeddings from your own model:Time Index
The time index enables chronological queries and time-travel features.How It Works
- Sorted tuples: Stores
(timestamp, frame_id)pairs in sorted order - MVTI magic: Identified by
MVTIheader bytes - O(log n) lookups: Binary search for efficient time range queries
- Checksummed: Protected by integrity verification
When to Use
Time-based access patterns:Time-Travel Queries
View your memory as it existed at a point in time:Rebuilding the Time Index
If timeline queries return incorrect results:Hybrid Search
Hybrid search (modeauto) combines lexical and semantic results for the best of both worlds.
How It Works
- Parallel query: Both lexical and vector indices are queried
- Result fusion: Scores are combined using reciprocal rank fusion
- Reranking: Top results are reranked for relevance
- Deduplication: Duplicate frames are merged
When to Use
Hybrid search is recommended for most use cases:Performance Comparison
Tracks
Tracks are logical groupings for organizing content within a memory.What Tracks Are
- Namespace: Group related documents together
- Filterable: Search within specific tracks
- Metadata: Organizational label stored with each frame
Using Tracks
Common Track Patterns
Index Statistics
Check the status of all indices:Best Practices
Index Selection
Performance Tips
- Use
put_many()for batch ingestion: 100-200x faster than individualput()calls - Enable vector compression for large collections to reduce storage
- Rebuild indices if search quality degrades after crashes
- Use hybrid mode for best recall on general queries
Maintenance
Regular index maintenance keeps search performing well:Next Steps
Memory Architecture
Understand the internal structure of .mv2 files
Search & Ask
Learn advanced search techniques