<!-- generated by build_articles.py — edit content/science/hybrid-vs-vector-vs-semantic-search.md instead -->
---
title: "Hybrid search vs vector search 2026: which to use for RAG and AI agents"
canonical: "https://xerj.org/science/hybrid-vs-vector-vs-semantic-search"
updated: "2026-11-18"
source: "content/science/hybrid-vs-vector-vs-semantic-search.md"
---

# Hybrid search vs vector search vs semantic search

**Short answer** (updated 2026-11-18): Hybrid search vs vector search: vector search ranks passages by closeness of meaning, so it finds paraphrases. Hybrid search runs BM25 full-text search next to it and fuses the two ranked lists, so exact names and close meanings both rank. Semantic search usually means vector search. For RAG and AI agents, hybrid is the safer default.

**TL;DR** Vector search ranks passages by closeness of meaning, so it finds paraphrases. Hybrid search runs a full-text search such as BM25 next to it and fuses the two ranked lists, so exact names and close meanings both rank. Semantic search usually means vector search. For RAG and AI agents, hybrid search is the safer default.

## Agent prompt

```text
Act as a coding agent. Read https://xerj.org/llms.txt, install XERJ, start a local node with --embed-mode neural, index one folder I point you to with xerj autoindex, then run the same question three ways (match, knn, and hybrid with fusion rrf) and show me the top 5 of each side by side with file paths, so I can see what hybrid search adds over vector search.
```

## Commands

### Command 1

Note: Install the single XERJ binary.

```sh
curl -fsSL https://xerj.org/get | sh
```

### Command 2

Note: Start a local node that embeds text with all-MiniLM-L6-v2. The model downloads once, about 90 MB.

```sh
xerj --embed-mode neural
```

### Command 3

Note: Index a folder. Full-text and vector fields go into the same index.

```sh
xerj autoindex ./docs --url http://127.0.0.1:9200 --progress plain
```

### Command 4

Note: One hybrid request. Fill query_vector with your embedding; the empty array marks where the floats go.

```sh
curl -s -XPOST 'http://127.0.0.1:9200/docs/_search' -H 'content-type: application/json' -d '{"query":{"hybrid":{"queries":[{"query":{"match":{"body":"server unreachable"}},"weight":1.0},{"query":{"knn":{"field":"body_vector","k":10,"num_candidates":50,"query_vector":[]}},"weight":1.0}],"fusion":"rrf"}},"size":5}'
```

## Which search fits your queries?

*Figure: Runs in your browser and sends nothing. Each answer adds a point to the option it matches. A rule of thumb, not a benchmark; the measured numbers are in the table below.*

## Hybrid, vector and semantic search side by side

| | Full-text (BM25) | Vector search | Semantic search | Hybrid search |
| --- | --- | --- | --- | --- |
| Ranks by | Query terms in the document, their rarity, document length | Closeness of embeddings | Meaning, almost always through vectors | Both lists, fused |
| Strong on | Exact names, IDs, error strings | Paraphrases, loose questions | Paraphrases, loose questions | Both kinds in one result list |
| Needs | An inverted index | Embeddings and a vector index | Same as vector search | Both, plus a fusion step |
| Typical use | Logs, code, product codes | Recommendations, "more like this" | Natural language search fields | RAG, AI agents, mixed queries |

*Figure: This comparison is a teaching account, not a new benchmark. Measured hybrid scores stay on the hybrid-search how-to and the published quality answers.*

## How vector search works

Vector search turns the query and each passage into an embedding, a list of numbers that stands for meaning. Passages whose vectors sit close to the query vector rank first. That is how a question like "server unreachable" can reach a passage that says "connection refused". The model choice matters: the same index gives different results with a different embedder.

Vector search is weaker where two items differ by one character, such as two product codes or two function names. Their embeddings sit close together, so the wrong one can rank first. The concept page is [semantic search](/science/semantic-search).

## How semantic search relates to vector search

Semantic search is the name for ranking by meaning instead of by exact words. In practice the method behind it is almost always a vector query. Product pages often use the two names for the same thing. This page keeps both phrases because people search for both.

## How hybrid search works

[Hybrid search](/science/hybrid-search) runs a full-text arm and a vector arm on the same question. Each returns a ranked list. A fusion step merges them into one list. The common choice is reciprocal rank fusion, which adds 1 / (k + rank) for every list a document appears in, with k = 60 in the original paper. It uses ranks, not raw scores, so a BM25 score and a cosine similarity never have to share a scale. The formula and a calculator are on the [reciprocal rank fusion](/science/reciprocal-rank-fusion) page.

Fusion also helps recall. A passage that only the vector arm found still reaches the fused list, and so does a passage that only BM25 found. For a RAG pipeline or an AI agent, that means fewer questions where the right passage never reaches the model.

## Measured: hybrid vs vector vs BM25 on BEIR

XERJ ran BM25, vectors only, a reorder arm and hybrid RRF on two public BEIR datasets. Hybrid RRF ranked first on both. On SciFact it scored nDCG@10 0.6993, against 0.6764 for vectors only and 0.6572 for BM25. On NFCorpus it scored 0.3448, against 0.3291 for vectors and 0.3016 for BM25. BM25 found no hits for 25 of the 323 NFCorpus queries, and the hybrid arm still returned results for every one of them.

*Figure: Runs in your browser and sends nothing. Measured by XERJ with --embed-mode neural and the built-in all-MiniLM-L6-v2 model; the default lexical embedder is not covered. Raw output is in benchmarks/beir-hybrid/results in the XERJ repository.*

These runs used `--embed-mode neural` with the built-in all-MiniLM-L6-v2 model. The default XERJ embedder is lexical and runs offline, and these vector figures do not apply to it. The full method is on [hybrid search quality, measured with nDCG](/answers/hybrid-search-quality-measured-ndcg).

## Run hybrid search on your own folder

1. Install: `curl -fsSL https://xerj.org/get | sh`
2. Start a local node with neural embeddings: `xerj --embed-mode neural`
3. Index a folder: `xerj autoindex ./docs --url http://127.0.0.1:9200 --progress plain`
4. Send one request with a `match` query, a `knn` query and `"fusion":"rrf"`. The full request is in the command list on this page.

Every command has a copy button. To hand the work to an agent, use Copy the prompt and paste it into Claude Code, Cursor or Codex. The agent runs the same question three ways and shows you what hybrid search adds. The step-by-step how-to is [how to run hybrid search in XERJ](/answers/what-is-hybrid-search).

## How XERJ uses it

XERJ answers a full-text query with BM25 by default. Neural or hybrid mode adds a vector arm, and both live in the same index, so there is no separate vector database to run. Agents reach the same search through `xerj mcp`. A side-by-side of the two arms is [BM25 vs vector search](/answers/bm25-vs-vector-search), and a RAG setup without a separate vector store is [RAG without a vector database](/answers/rag-without-vector-database).

## History and research

Dense vector retrieval is described by Karpukhin and colleagues in [Dense Passage Retrieval for Open-Domain Question Answering](https://arxiv.org/abs/2004.04906) (EMNLP 2020). BM25 is surveyed by Robertson and Zaragoza in [The Probabilistic Relevance Framework: BM25 and Beyond](https://doi.org/10.1561/1500000019) (2009). Fusion is described by Cormack, Clarke and Buettcher in [Reciprocal Rank Fusion outperforms Condorcet and individual Rank Learning Methods](https://cormack.uwaterloo.ca/cormacksigir09-rrf.pdf) (SIGIR 2009). Those papers are research sources, not XERJ measurements.

## Related terms

[Hybrid search](/science/hybrid-search), [BM25](/science/bm25), [semantic search](/science/semantic-search), [reciprocal rank fusion](/science/reciprocal-rank-fusion) and [vector database vs full-text search](/answers/vector-database-vs-full-text-search).

## FAQ

### Is hybrid search better than vector search?

On the two BEIR datasets XERJ measured, yes. Hybrid RRF scored nDCG@10 0.6993 against 0.6764 for vectors alone on SciFact, and 0.3448 against 0.3291 on NFCorpus. Test it on your own queries before you decide.

### Is semantic search the same as vector search?

In practice, almost always. Semantic search means ranking by meaning, and the usual method is a vector query over embeddings. Some writers use the two names for the same thing.

### What does hybrid search add to vector search?

A full-text arm, such as BM25, and a fusion step. Exact names, codes and error strings rank well through BM25, close meanings rank well through vectors, and the fused list keeps both.

### Should I use hybrid search for RAG?

It is the safer default for RAG, because user questions mix exact terms and loose wording. A passage that only one arm finds can still reach the model.

### When is vector search alone enough?

When queries are loose paraphrases over short texts and exact identifiers rarely matter, such as recommendations or a 'more like this' feature.

### When is BM25 alone enough?

When almost every query is an exact identifier, a name or an error string. BM25 is also the fastest of the three.

### Do I need a vector database for hybrid search?

No. You need one place that holds an inverted index and vectors. XERJ keeps both in the same index and fuses them inside one request.

## Evidence

- On BEIR SciFact (300 test queries, 5,183 documents) nDCG@10 was 0.6572 for BM25, 0.6764 for MiniLM vectors only, 0.6855 for a BM25 top-30 shortlist reordered by MiniLM, and 0.6993 for hybrid RRF. Source: `benchmarks/beir-hybrid/results/scifact.txt`
- On BEIR NFCorpus (323 test queries, 3,633 documents) nDCG@10 was 0.3016 for BM25, 0.3291 for MiniLM vectors only, 0.3323 for the reorder arm, and 0.3448 for hybrid RRF. BM25 returned zero hits for 25 of the 323 queries. Source: `benchmarks/beir-hybrid/results/nfcorpus.txt`
- Reciprocal rank fusion adds 1 / (k + rank) for each list a document appears in; the paper uses k = 60. Source: [https://cormack.uwaterloo.ca/cormacksigir09-rrf.pdf](https://cormack.uwaterloo.ca/cormacksigir09-rrf.pdf)

## Related

- [What is hybrid search?](/science/hybrid-search)
- [BM25 vs vector search](/science/bm25)
- [What is semantic search?](/science/semantic-search)
- [Reciprocal rank fusion formula](/science/reciprocal-rank-fusion)
- [How to run hybrid search in XERJ](/answers/what-is-hybrid-search)
- [BM25 vs vector search: which one should you use?](/answers/bm25-vs-vector-search)
- [How much better is hybrid search than BM25? Measured nDCG numbers](/answers/hybrid-search-quality-measured-ndcg)
- [RAG without a vector database: 3 vectorless RAG setups that work](/answers/rag-without-vector-database)
- [Neurosymbolic AI frameworks in 2026: open source tools for LLM reasoning and agent memory](/compare/neurosymbolic-ai-frameworks-2026) (same intent: Science)
- [Neurosymbolic AI vs LLMs](/science/neurosymbolic-ai) (same intent: Science)
- [What are grounded answers?](/science/grounded-answers) (same intent: Science)
