#14005: fix(memory): bm25RankToScore returns constant 1.0 for all negative BM25 ranks
stale
Cluster:
Memory Management Enhancements
FTS5 `bm25()` returns negative values (more negative = more relevant), but `bm25RankToScore` was doing `Math.max(0, rank)` which clamps all negative scores to 0. That means `1 / (1 + 0)` = 1.0 for every result, so BM25 relevance was completely thrown away in hybrid search.
Fixed by using `Math.abs(rank)` instead, which preserves the magnitude while keeping the normalization formula working.
Added test assertions for monotonic behavior with negative inputs.
Fixes #5767
Most Similar PRs
#15339: fix: BM25 score normalization and FTS5 query join operator
by echoVic · 2026-02-13
73.0%
#20994: fix(memory): correct bm25RankToScore for negative FTS5 ranks
by qdx · 2026-02-19
67.8%
#15234: fix(memory): use OR instead of AND in FTS5 query builder
by niceysam · 2026-02-13
58.8%
#21269: feat(memory): add Reciprocal Rank Fusion (RRF) as alternative fusio...
by cedillarack · 2026-02-19
52.4%
#20799: fix: replace Math.max/min spread with reduce to prevent stack overflow
by mariusorani · 2026-02-19
50.1%
#19920: fix(memory): populate FTS index in FTS-only mode so search returns ...
by forketyfork · 2026-02-18
45.3%
#18919: feat: importance-weighted temporal decay for memory search
by ruypang · 2026-02-17
45.0%
#19945: memory: gracefully disable hybrid keyword search when fts5 unavailable
by nico-hoff · 2026-02-18
44.6%
#17686: fix(memory): support non-ASCII characters in FTS query tokenization
by Phineas1500 · 2026-02-16
44.3%
#22901: fix: guard against NaN reserveTokens in compaction safeguard
by miloudbelarebia · 2026-02-21
44.0%