Skip to content
MNMohammed Nisaruddin
All articles
RAG EngineeringEducational

Vector Search vs Traditional Search

How keyword search and vector search actually differ, where each one fails, and why most production systems end up using both.

By Mohammed Nisaruddin · · 2 min read

Educational article — general engineering guidance, not an account of a specific project.

Vector search is often presented as a replacement for keyword search. In practice they solve different problems, and the systems that work best combine them. Here is how to think about the choice.

How keyword search works

Traditional search engines build an inverted index: for every term, a list of the documents that contain it. A query is scored with an algorithm such as BM25, which rewards documents where the query terms appear often, and gives more weight to rare terms than common ones.

It is fast, well understood and transparent — you can always explain why a document matched. Its weakness is vocabulary. Search for "car" and a document that only says "automobile" will not appear.

How vector search works

Vector search converts text into embeddings — lists of numbers produced by a model so that texts with similar meaning end up close together. A query is embedded the same way, and the engine returns the nearest stored vectors, usually with an approximate nearest-neighbour index for speed.

Because it compares meaning rather than words, it handles synonyms, paraphrases and even other languages. Its weakness is precision on exact terms. A part number, a person's name or an error code may be treated as roughly similar to many others.

Side by side

Keyword search Vector search
Matches on Exact terms Meaning
Strong at Codes, names, rare terms Paraphrases, natural questions
Weak at Synonyms, vague queries Exact identifiers, numbers
Explainable Yes — matched terms Harder — a similarity score
Needs a model No Yes, an embedding model
Index updates Cheap Requires re-embedding

Where each one fails

A user types policy HX-2291 exclusions. Keyword search finds the document instantly. Vector search may return exclusions from several similar-looking policies, because the identifier carries little semantic meaning.

Another user asks, "what isn't covered if I get hurt abroad?" Keyword search struggles — none of those words may appear in a clause titled "Territorial limits and exclusions". Vector search finds it easily.

Real users ask both kinds of question, often in the same session.

Hybrid search

Hybrid search runs both and merges the results. A common, simple merging method is reciprocal rank fusion, which only needs each list's ranking:

def reciprocal_rank_fusion(result_lists, k=60):
    scores = {}
    for results in result_lists:
        for rank, doc_id in enumerate(results):
            scores[doc_id] = scores.get(doc_id, 0.0) + 1.0 / (k + rank + 1)
    return sorted(scores, key=scores.get, reverse=True)

A re-ranking model applied to the top merged results improves ordering further, at the cost of some latency.

How to choose

  • Structured identifiers and known terminology — start with keyword search.
  • Natural-language questions over prose — start with vector search.
  • A mix, or a RAG application — use hybrid search. This is the usual answer.

Whatever you choose, measure it. Collect real queries, mark which documents should be returned, and compare approaches on that set. Search quality is an empirical question, and a small labelled set will tell you more than any general rule — including the ones in this article.

Written by Mohammed Nisaruddin

Senior AI & Data Engineer working on Generative AI, RAG and data platforms. Get in touch if you are working on something similar.

Have an AI or Data Engineering challenge? Let's turn it into a working product.

Taking on a limited number of AI and data engineering projects. Typical reply within 2 business days.