# Hybrid search

> Hybrid search combines keyword search and semantic vector search in one query and merges their results, so a system finds both exact matches such as product codes and passages that match by meaning.

Also called: hybrid retrieval, keyword plus vector search, BM25 and vector search. Category: Data and retrieval. Source: https://aibuildindex.com/glossary/hybrid-search

## In the index

- Search over internal documents: median $2,150, middle half $300 to $8,800, 918 priced briefs (https://aibuildindex.com/cost/document-search-rag)
- RAG: median $3,860, middle half $500 to $14,400, 586 priced briefs (https://aibuildindex.com/skills/rag)

Keyword search and semantic search fail in opposite ways. Keyword search misses documents that use different words; semantic search misses exact identifiers such as SKUs, error codes and names, and sometimes returns things that are merely similar. Hybrid search runs both and blends the results. It has become a common default in production [retrieval-augmented generation](https://aibuildindex.com/glossary/retrieval-augmented-generation) systems because business documents are full of both plain language and precise codes.

## How it works

The query goes down two paths. The keyword path uses a classic ranking method such as BM25, which scores documents on how often the query terms appear and how rare those terms are. The semantic path embeds the query and finds the nearest passages in a [vector database](https://aibuildindex.com/glossary/vector-database). The two ranked lists are then merged. A common merging method is reciprocal rank fusion, which rewards documents that rank highly in either list without needing the two scores to be on the same scale. Some systems instead weight the two scores, tuning the balance on test queries.

Many search engines and vector databases now support both kinds of index natively, including Elasticsearch, OpenSearch, Weaviate and PostgreSQL with full-text search plus pgvector. A [reranking](https://aibuildindex.com/glossary/reranking) step often follows to reorder the merged list.

An example: a support assistant receives "Error E-4012 when exporting to CSV". The keyword path finds the troubleshooting page that mentions E-4012; the semantic path finds a general article about export failures. Hybrid search returns both, and the specific page ranks first.

## What it means for cost

Adding hybrid search to a RAG build is a moderate increase in effort: a second index to maintain, a merging method to choose and some tuning. It usually pays for itself wherever users search for codes, names or exact phrases. Running costs change little, since keyword search is cheap.

Ask a builder whether their retrieval handles exact identifiers, and how they tested it. A set of real queries, including awkward ones with codes and abbreviations, is the honest way to show that hybrid search beats either method alone. Live figures for retrieval builds are on the [document search and RAG cost page](https://aibuildindex.com/cost/document-search-rag).

## Common questions

### When is hybrid search worth it?

When users search with a mix of natural questions and precise terms, as in technical support, legal and compliance documents, product catalogues and internal wikis. For a small collection of plain prose with conversational questions, semantic search alone may be enough.

### Does hybrid search replace reranking?

No, they do different jobs. Hybrid search widens the net so relevant passages are among the candidates. Reranking then reads those candidates closely and puts the best ones first. Strong systems often use both.

## Related terms

- [Semantic search](https://aibuildindex.com/glossary/semantic-search): Semantic search is search that matches by meaning rather than exact words, typically by comparing embeddings, so a query such as "how do I get my money back" can find a page titled "Refund policy".
- [Reranking](https://aibuildindex.com/glossary/reranking): Reranking is a second retrieval step in which a more precise model rescores the top results from a first, faster search and reorders them by relevance to the query, so the best passages reach the user or language model first.
- [Vector database](https://aibuildindex.com/glossary/vector-database): A vector database is a data store built to save embeddings, the numeric representations of text, images or audio, and to find the stored items most similar in meaning to a query, which makes it the usual search layer behind RAG systems.
- [Retrieval-augmented generation (RAG)](https://aibuildindex.com/glossary/retrieval-augmented-generation): Retrieval-augmented generation is a way of answering questions with a language model that first looks up relevant passages in your own documents, then writes an answer grounded in what it found.
- [Embedding](https://aibuildindex.com/glossary/embedding): An embedding is a list of numbers that represents the meaning of a piece of text, an image or another item, so that items with similar meanings end up close together and can be compared, searched or grouped by software.
- [Knowledge base](https://aibuildindex.com/glossary/knowledge-base): A knowledge base is an organised collection of a business's information, such as help articles, policies, product details and past answers, that people or AI systems consult to answer questions consistently.
