All articles
RAG · Search systems

What is RAG? How hybrid search reached 96% recall

What retrieval-augmented generation is and why it cuts hallucinations, with step-by-step notes from a real project that combined BM25 and vectors to hit 96%.

Language models know a lot, but they do not know your documents. Ask about something they have not seen and they will often invent a confident answer instead of saying “I don’t know”. RAG (retrieval-augmented generation) is the most practical fix.

How does RAG work?

  1. Retrieve: when a question arrives, search your own document store first.
  2. Read: hand the most relevant passages to the model as context.
  3. Answer: the model writes the answer from those passages, with sources.

Your current, verifiable documents do the talking instead of the model’s memory. When documents change you re-index; no retraining.

The real work: search quality

Answer quality in RAG depends mostly on the retrieve step. A model cannot use a document it never sees, which is why most of my time in KBÜ MCP went into search.

  • Keyword search (BM25F with Turkish stemming): strong for exact phrases such as “Article 12”, course codes or names.
  • Semantic search (pgvector + bge-m3): strong for questions that do not share words with the answer.
  • Fusion (Reciprocal Rank Fusion): merges both rankings so whichever is better for that question wins. Results are also weighted by date, so an old regulation does not outrank the new one.

No RAG without clean data

Half of a web page is menus, footers and repeated templates. Index them as-is and search fills up with “Contact” and “Home”. I wrote extractors that turn everything into clean Markdown: template chrome removed, PDF tables kept, scanned documents OCR’d ahead of time.

Don’t say “it works” without measuring

I built an evaluation set of real questions and the document that holds each answer. After every change I re-ran it and checked recall@5 (is the right document in the top five?). It currently sits at 96%. When you get a quote for a RAG system, “how do you measure it?” is the most important question to ask.

Where RAG is not enough

  • Questions that need an action: “cancel my order” is not a search, it is an action. That takes a tool-using agent, which is how AsistanChat works.
  • Questions that need calculation: totals and averages are more reliable from a tool that queries data directly.
  • Access control: in internal RAG not everyone should see every document; enforce permissions in the search layer.

Summary

A good RAG system is clean data, hybrid search, a model that cites and regular measurement. The model choice matters less than people think. If your documents are scattered and people keep asking the same questions, RAG is a good place to start.

Want a similar system built on your own data?

Let's talk about your project