Tags: sochdb/sochdb-python-sdk
Tags
fix: insert/insert_batch now write to KV store; fix BM25 fallback to …
…use proper IDF formula
Three bug fixes in namespace.py:
1. insert() now dual-writes to HNSW (in-memory) AND KV store
- Before: insert() only populated _vector_index and _metadata_store
- After: also persists JSON doc to KV using same schema as insert_multi()
- Impact: docs inserted via insert() were invisible to keyword_search()
and the BM25 leg of hybrid_search()
2. insert_batch() now dual-writes to HNSW AND KV store
- Same root cause as insert() — batch inserts were KV-invisible
- All docs in a batch are written in a single atomic transaction
3. Python BM25 fallback replaced TF-count with proper BM25 formula
- Before: score += count(term in doc) — no IDF, no length normalisation
- After: BM25 with k1=1.2, b=0.75 (Robertson-Sparck Jones IDF)
- Matches the native Rust bm25.rs implementation (bm25.rs: k1=1.2, b=0.75)
- Fixes ranking quality when FFI keyword search returns None
Bumps version to 0.5.5.
PreviousNext