cd /news/ai-tools/four-lines-of-aliases-fixed-what-nei… · home › topics › ai-tools › article
[ARTICLE · art-181167] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=↑ positive

Four lines of aliases fixed what neither a reranker nor an LLM rewrite could

A developer added a DOCSRAG_ALIASES setting to the docs-rag-mcp RAG server (version 0.11.0), letting a plain-text file map developers' vocabulary to documentation terms at search time without a model in the loop. On 30 real questions about the MCP C# SDK, four lines of aliases raised the correct page to first place for 25 of 30 questions (up from 21) and top-20 recall to 30 of 30, beating bge-reranker-v2-m3 (23) and a qwen2.5 7B query rewrite (11).

recommendation

Mine missed queries from GitHub issues and support tickets, then add whole-word alias lines mapping user vocabulary to doc vocabulary at search time instead of paying for an LLM rewrite on every query.

more in playbook: Retrieval and RAG
by read3 min views11 publishedDec 3, 2026

In my last post, I tested my local RAG server on 30 questions developers actually asked about the MCP C# SDK, copied from its GitHub issues and discussions. Three of them were never found, by any search mode, because they use words the docs don't:

A reranker can't fix that, because it only reorders what the search found. Rewriting the question with a local LLM made things worse: qwen2.5 kept the word "middleware" and added generic terms, and the right page came first for 11 to 13 questions instead of 21.

In the comments, @ontomato suggested something simpler: keep an alias list, the developer's word mapped to the docs' word, and apply it at search time without a model in the loop. So I built it.

docs-rag-mcp 0.11.0 has a new setting, DOCSRAG_ALIASES, that points to a text file. These four lines are all I used for the SDK docs:

middleware, interceptor = filters
in-proc, in-process, in process = in-memory transport
load balancer, multiple instances, multi instances = stateless mode
http headers, query string = HttpContext

When a question contains a word or phrase from the left side, as a whole word, the words on the right are added to it before searching. So "How to implement a tool middleware?" is searched as "How to implement a tool middleware? filters". The embedding, the keyword search and the reranker all see the docs' word. The developer's words stay too, so nothing is lost.

On the 30 real questions, with hybrid search and no reranker:

Right page first In the top 20 MRR
Without aliases 21 of 30 27 of 30 0.75
With aliases 25 of 30 30 of 30 0.88

Both "middleware" questions and both in-process questions moved to first place. On the 22 questions I wrote myself, every question ranked exactly as before.

Here is how the three fixes compare on the same 30 questions:

Fix Right page first
None (hybrid search) 21
Reranking with bge-reranker-v2-m3 23
Rewriting with qwen2.5 7B 11
Four lines of aliases 25

I wrote the aliases after seeing which questions were missed. So this shows that the mechanism works for words you know people use. It doesn't show how well a list written in advance would guess them.

In practice, that's how you'd use it anyway. You look at the questions your search missed, see that people say "middleware" and your docs say "filters", and add a line. Support tickets, GitHub issues and chat logs are where those words come from.

A model that knows your docs' vocabulary could do the same thing. But a small local model didn't, and every search would pay for the model call. An alias file costs nothing at search time, you can read it, and you can review it in a pull request like any other code.

The evaluation sets, the alias file and the numbers are in the repo under samples/eval/.

── more in #ai-tools 4 stories · sorted by recency
── more on @docs-rag-mcp 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/four-lines-of-aliase…] indexed:0 read:3min 2026-12-03 · —