Three things commenters asked me to measure in my local RAG server, and what the numbers said
A week ago I wrote about adding a reranker to docs-rag-mcp, my local RAG server for Claude, Copilot and other MCP clients. The right page came first for 18 of 22 questions instead of 12.
The comments on that post and the one before it asked good questions I couldn't answer yet. Version 0.9.0 measures three of them. Two answers were not what I expected.
1. Is the right page even reaching the reranker?
A reranker can only reorder what the first search gives it. If the right page isn't among the candidates, no reranker will save it. So the evaluation now asks for 20 passages, the number the reranker chooses from by default, and reports how often the right page is among them (recall@20).
On the MCP C# SDK docs (30 pages, 556 chunks, 22 questions):
| Search mode | Right page first | In the top 3 | In the top 20 | MRR |
|---|---|---|---|---|
| vector | 11 of 22 | 15 of 22 | 21 of 22 | 0.61 |
| hybrid | 12 of 22 | 17 of 22 | 22 of 22 | 0.66 |
| hybrid + reranking | 19 of 22 | 20 of 22 | 22 of 22 | 0.91 |
Hybrid search has the right page in the top 20 for every question. So the three questions reranking still gets wrong are the reranker's own choices, not missing candidates. One example: for "How do I stop a tool when the user gives up waiting?", hybrid search puts the cancellation page first, and the reranker moves it to fourth.
That tells me where to look next: the reranker, not the number of candidates.
2. Can a score cutoff detect questions the docs don't answer?
search_docs always returns the nearest passages, even when nothing in the documents answers the question. A commenter suggested testing that case, so I added questions with no answer: 5 for the SDK docs (Kubernetes, xUnit, OpenAPI, F#, translation) and 6 for the sample handbook (vacation, sick leave, car rental, gym, parental leave, dogs).
I expected their best passage to score clearly lower. It doesn't. The best passage for "Can I write my MCP server in F#?" scores 0.70, more than the median answerable SDK question (0.64). A cutoff low enough to keep a result for every answerable question catches only 1 of the 5 SDK questions without an answer, and 2 of the 6 for the handbook.
So there is no cutoff. The assistant that reads the passages is better placed to say "the docs don't cover this" than a similarity threshold is.
3. Can one weak keyword match get a full keyword score?
Hybrid search blends 90% meaning and 10% keywords, and keyword scores are divided by the best one. Another commenter pointed out that when only a weak keyword match comes back, it still scales to 1.0.
It's worse than that in SQLite. FTS5 gives a word found in half of the passages or more a weight of 0.000001. Divide by the best score and that near-zero match becomes a perfect keyword match. Keyword scores are now divided by at least 0.01.
On both evaluation sets, no question changed rank. The 10% weight was already limiting the damage. But there is now a unit test where a match on a common word used to beat a better meaning match, and it doesn't anymore.
A bonus lesson: my first numbers were wrong
The first run for this post was on a 2-core machine, and reranking looked much worse. The reason: reranking 20 passages with bge-reranker-v2-m3 on CPU takes about 43 seconds on 2 cores, and the server gave up after 30 seconds and kept the normal order. Many rerank calls timed out without anyone noticing, and the evaluation reported those results as the reranker's score.
On 4 cores it takes about 25 seconds and every call finished. The evaluation now warns when a rerank call fails or times out, and the timeout is configurable (DOCSRAG_RERANK_TIMEOUT, contributed by daocuong11).
If you measure a reranker on a laptop, check that it actually ran.
What's next
- 0.10.0 reads OpenDocument Text (
.odt) files, thanks to VInthiranathan's first contribution. - reStructuredText and AsciiDoc support is in review.
- One commenter asked how I wrote the 22 SDK questions: I wrote them while reading the docs, which probably favors keyword search. A set built from real GitHub issues would be fairer, and that's on the list.
Both evaluation sets and the script are in the repo (samples/eval/), so you can check any of these numbers yourself.