Modern Search Explained: FTS, Embeddings, RAG and More
Introduction
Modern AI systems such as chatbots, search engines and RAG applications are built on a combination of several technologies. Terms like FTS, embeddings and re-ranking come up again and again.
This article explains the most important fundamentals – technically accurate, but easy to follow.
1. FTS (Full-Text Search)
Full-text search is the classic way of searching text content. It is based on:
Tokenization (breaking text apart)
Stemming (identifying word stems)
Stopwords (ignoring irrelevant words)
FTS is particularly good for:
exact terms
names, IDs, technical vocabulary
2. BM25
BM25 is a ranking algorithm for FTS.
It scores documents based on:
how often a term appears
the length of the document
how rare a term is
BM25 decides which document is „most relevant“.
3. Embeddings / Vector Search
Embeddings turn text into numeric vectors:
"cancel contract" → [0.23, -0.88, ...]That makes semantic search possible:
similar meaning is recognized
not just exact words
4. Hybrid Search
Hybrid search combines:
FTS + embeddingsWhy?
FTS → precise words
embeddings → meaning
Together they deliver considerably better results.
5. Top-K Retrieval
Top-K describes the selection of the best results:
Top 5, Top 10, Top 20These are then handed to the LLM.
6. Re-Ranking
Re-ranking is a second step after the search:
Top 50 results → reorder → Top 5Often using:
LLMs
cross-encoders
specialized models
→ a large gain in quality
7. Chunking
Documents are split into smaller pieces:
better search
more precise answers
What matters:
not too large
not too small
semantically coherent
8. HNSW (ANN)
HNSW is an algorithm for fast vector search.
It belongs to:
Approximate Nearest Neighbor (ANN)
Advantages:
very fast
scales well
9. RAG (Retrieval-Augmented Generation)
RAG combines search with AI:
search → context → LLM → answerAdvantages:
current data
your own documents
fewer hallucinations
How the Components Work Together
Documents
→ Chunking
→ Embeddings
→ Storage (PostgreSQL + pgvector, for example)
→ Hybrid Search (FTS + vector)
→ Top-K Retrieval
→ Re-Ranking
→ LLM (RAG)
→ AnswerConclusion
Modern search is not a single feature – it is a system made of several components:
FTS & BM25 → words
embeddings → meaning
hybrid search → the combination
re-ranking → quality
RAG → the AI application
The quality of your AI depends directly on your retrieval stack.