Internals: Index Algorithms
BM25 (Tantivy)
- Full-text index is a Tantivy index in a separate directory, not RocksDB.
- Pinned contract:
k1 = 1.2, b = 0.75, analyzer id unicode_jieba_v1 (jieba tokenizer), analyzer version 1.
- A profile’s BM25 fields map to Tantivy
TEXT/STORED schema fields; queries run through a Bm25StatisticsProvider.
search/bm25/3 return scored entity references from the stored document fields.
Vector similarity
exact: brute-force scan over the RocksDB vector: store.
hnsw: an optional approximate index built asynchronously and immutably from exact vectors. Exact RocksDB is always source of truth and fallback.
- HNSW publication is generation-versioned; missing/stale/rebuilding/incompatible/corrupt ANN state falls back to exact automatically.
- Embeddings come from an embedding provider (default Ollama
bge-m3:latest, 1024-dim); chunking (whole_field, explicit, paragraph_heading, fixed_token_window) is declared per profile field.
Temporal
EventTimeStore (event instants) and ValidityStore (valid_from/valid_to intervals) live in RocksDB under temporal:.
- Node versions carry
valid_from timestamps; temporal_on / temporal_between / valid_at / valid_overlaps read versioned property state and the temporal stores.
Tabling
- Positive fixpoint evaluation: seed from provider facts, iterate rule evaluation, dedupe ground answers, stop at a fixpoint (bounded by max iterations / max answers).
- Tables persist under
table:meta + table:answer and reload across reopen.
- Reverse dependency indexes (
table:revdep:*) map fact/rule/table mutations to dependent tables, enabling selective invalidation with a full-recompute fallback.
Stratification analysis
- Signed dependency graph over user-rule predicates (external/builtin/provider predicates are dropped as always-complete).
- Tarjan SCC + condensation stratum assignment; a negative edge inside an SCC is a violation reported as a structured cycle.
- Analysis runs at rule-write time (
analyze_with_candidate) and read-only through analyze_rules.