Expand description
Deterministic retrieval rankers: cosine similarity, lexical BM25, reciprocal-rank fusion, and structural graph boosting.
Every function here is pure and parameter-pinned, and none of them calls
a model — embedding vectors come from the caller. Because the parameters
are fixed and versioned by RANKING_VERSION, two runs over the same
inputs produce the same ranking, which makes these rankings measurable
against a fixture set before you let them influence anything.
Structs§
- Bm25
Index - BM25 index over a fixed corpus.
- Cosine
Spec - Identity a caller must present before mixing two embedding vectors.
- Evidence
Link - One evidence fragment for production adjacency extraction.
Enums§
- Ranking
Error - Why a cosine comparison cannot be trusted.
Constants§
- ADJACENCY_
KIND - Production graph features: file spans and split siblings, not fixture pairs.
- RANKING_
FIXTURE_ SET - Identity of the retrieval fixture set this ranking is measured against.
- RANKING_
VERSION - Identifies the pinned ranking parameters, so a measured result can be attributed to the exact algorithm that produced it.
Functions§
- build_
adjacency - Symmetric adjacency over corpus indices from declared related pairs; malformed or unknown entries are ignored.
- cosine_
checked - Same as
cosine_similarity, with digest and unit-norm checks. - cosine_
similarity - Cosine similarity computed in f64; zero vectors compare as 0.
- evidence_
adjacency - Structural pairs from evidence: split siblings and the same source file.
- graph_
boost - Re-rank a fused ranking with a structural neighbor lift in rank space:
a document related to one of the fused top-
GRAPH_TOP_Mdocuments is treated as rankedGRAPH_RANK_PENALTYbehind its best benefactor. It can overtake unrelated mid-ranked documents but never the benefactor itself. - parent_
id WX-VERIFY-2→WX-VERIFY; ids without a trailing-<digits>stay as-is.- rank_
by_ similarity - Corpus indices ranked by descending similarity; ties break by index for determinism.
- rank_
hybrid_ graph - The
hybrid_graphpipeline: cosine + BM25 RRF, then structural boost. - rrf_
fuse - Reciprocal-rank fusion of several rankings over the same corpus.
- tokenize
- Lowercased alphanumeric tokens.