fix(retrieval): honor retrieval.rrf_k in hybrid search

Merged
LE
7d ago
+41-104

retrieval.rrf_k is documented in docs/configuration.md and settable with vera config set, but the main hybrid search ignored it: search_service.rs took k from the per-query-type QueryParams, which hard-coded 60.0 for both query types. Only multi-query merging (CLI multi-query, MCP, --deep) read the config.

  • Hybrid search now reads config.retrieval.rrf_k. The default is still 60, so default results are unchanged.
  • Removes the now-unused QueryParams::rrf_k field and the two tests that only asserted both query types shared k=60.
  • Records a full 1,251-task Semble sweep (k = 5, 10, 30, 60, 120) in docs/benchmarks-history.md. All values sit within 0.001 nDCG@10 of k=60, so the default stays.

Found while checking whether tuning the RRF constant was worth doing: before this fix, the sweep produced byte-identical scores for every k.


Devin Review


Summary by cubic

Fixes hybrid search so it honors retrieval.rrf_k — previously the main search path fused with a hard-coded k=60 from per-query-type QueryParams, and only multi-query merging (CLI multi-query, MCP, --deep) read the config. Adds a fallback to the default k when a hand-edited config holds a non-finite or non-positive value, which would otherwise break the 1/(k + rank) fusion ordering. Removes the now-unused QueryParams::rrf_k field and the tests that only asserted both query types shared k=60; adds a test for the invalid-k fallback. A full 1,251-task sweep (k = 5, 10, 30, 60, 120) recorded in docs/benchmarks-history.md puts every value within 0.001 nDCG@10 of the default (60), so the default stays and default results are unchanged.

Summary by CodeRabbit

  • Bug Fixes
    • Search ranking now respects the configured reciprocal-rank fusion setting instead of always using a fixed value. Invalid settings fall back to the default, which remains unchanged.
  • Documentation
    • Added benchmark results comparing search quality across several fusion settings, with results showing similar performance to the existing default.