pub fn rerank_passages(
query: &str,
passages: Vec<(u64, String, f64)>,
rerank_depth: usize,
alpha: f64,
pool_n: usize,
) -> Result<Vec<(u64, f64, Option<f64>)>, String>Expand description
0.8.2 Slice E2 — standalone CE rerank of a caller-supplied passage list.
The pure, testable core that the fathomdb.rerank pyo3 binding is a thin
wrapper over. Slice 5’s fused_rerank comparator must CE-rerank its OWN
in-harness fused(bm25+dense) pool — a pool the engine’s search() never
constructs — so the CE has to be reachable over an arbitrary passage list,
not just the engine’s capped text-only pool. This adapts (id, body, score)
passages into SearchHits (kind = "passage", branch = Vector,
source_id = None; only body and score feed the blend), runs them
through [rerank_fused], and projects back to (id, score, ce_score) in the reranked
order.
Contract (inherited verbatim from rerank_fused): rerank_depth == 0 OR an
empty list returns the input order WITH the input scores, byte-identical — no
model load, no network. With --features default-reranker and
rerank_depth > 0 the CE blends the top-depth and may reorder; with the
feature off the CE path compiles away and this is always identity.
0.8.2 Slice E2 fix-1 [P2]: returns Err when any passage carries a non-finite
score (NaN / ±inf), mirroring the malformed-passage loud-fail contract.
Callers (pyo3 rerank binding, tests) must handle Result.
(#[must_use] removed: Result is already #[must_use].)