DocsSearch
Ranking & Scoring Explained
On this page
The Six Ranking Modes#
Cycle through modes with F12 (or Alt+R) in the TUI. The search engine returns hits in its own relevance order; the mode then re-orders the results the TUI has loaded (the first page of up to 250 hits, plus every further page you load), so the whole loaded list always follows one order. Ranking modes are TUI-only; robot search returns engine order.
-
Recent Heavy: Score =
relevance × 0.3 + recency × 0.7. Best for: "What was I working on?" -
Balanced (default): Score =
relevance × 0.5 + recency × 0.5. Best for general-purpose search. -
Relevance: Score =
relevance × 0.8 + recency × 0.2. Best for "find the best explanation of X". -
Match Quality: exact matches first, then prefix, suffix, substring, wildcard, and finally automatic wildcard-fallback matches; within each class, the Relevance score. Best for precise technical searches.
-
Date Newest: newest first by message time. Best for "show me recent activity".
-
Date Oldest: oldest first. Best for "when did I first work on this?"
Undated hits sort last in the date modes. Hits with equal scores keep the engine's order. With an empty query, cass browses by date instead of searching; Date Oldest browses oldest first and every other mode newest first.
Score Components#
-
Relevance: the engine's score (BM25 for lexical search, fused rank for hybrid), min-max normalized over the loaded hits: the best loaded hit is 1.0 and the weakest 0.0 (all 1.0 when every score ties).
-
Recency: exponential decay from now with a 14-day half-life,
0.5 ^ (age_days / 14): 1.0 today, about 0.71 after a week, 0.5 after two weeks, about 0.23 after a month. Undated hits get 0.
The formulas live in src/ui/ranking.rs, and the tests in that file and in tests/ranking.rs exercise the same function the TUI calls.