ANSWERS · HYBRID RETRIEVAL: ARCHITECTURE

RAG without a vector database: 3 vectorless RAG setups that work

AUTHOR · XERJ documentation team · REVIEWED BY · XERJ engineering team · PUBLISHED · 2026-08-21 · UPDATED · 2026-11-15
SHORT ANSWER · UPDATED 2026-11-15

How do I build RAG without a vector database? Retrieve with BM25 keyword search, the document's own structure, or one search engine that stores vectors beside the text. On BEIR SciFact, XERJ hybrid search scored nDCG@10 0.6993, above BM25 alone (0.6572) and vectors alone (0.6764), from one index.

Key number: On BEIR SciFact, hybrid RRF with the opt-in neural embedder scored nDCG@10 0.6993, above both BM25 (0.6572) and vectors alone (0.6764). (as of 2026-09-18 · source: benchmarks/beir-hybrid/results/scifact.txt)

TL;DR Yes, you can build RAG without a vector database, often called vectorless RAG. RAG needs a retriever, and three kinds work well without one: BM25 keyword search (SQLite FTS5 or a search engine), the document's own structure, or one search engine that keeps vectors beside the text. On BEIR SciFact, XERJ hybrid search scored nDCG@10 0.6993, above BM25 alone (0.6572) and vectors alone (0.6764), all from one index.

Try it: three retrievers, no vector database

Pick a route and copy its first step

keyword search: exact terms, ranked

SELECT source, body FROM chunks
WHERE chunks MATCH 'restart OR recover'
ORDER BY bm25(chunks) LIMIT 3;

Best for names, codes, error strings and identifiers. SQLite FTS5 or a search engine, no embeddings.

structure: let the model read the outline

  1. 1. Build the outline

    Headings and section titles become a table of contents.

  2. 2. The model picks sections

    It reads the outline and names the sections that look relevant.

  3. 3. Read in full, then answer

    Only the chosen sections go into the prompt.

Best for a few long, well-organized documents. More model calls per question.

one hybrid index: BM25 plus vectors, fused

{"query":{"hybrid":{"queries":[
  {"query":{"match":{"text":"..."}},"weight":1.0},
  {"query":{"knn":{"field":"text_vector","k":3,
    "num_candidates":50,"query_vector":[]}},"weight":1.0}],
  "fusion":"rrf"}},"size":3}

Best when users phrase questions in their own words. XERJ keeps the vector beside the text, so no second service runs.

The FTS5 query uses SQLite's built-in bm25() function (sqlite.org/fts5.html, checked 2026-11-14). The hybrid request is the XERJ shape shown in the article; the empty array is where the query vector goes.
PASTE THIS TO YOUR AI AGENT. IT DOES THE REST Act as a coding agent. Read https://xerj.org/llms.txt, start one single-node XERJ, create an index with a semantic_text field, bulk-load the corpus, then run one hybrid request with fusion rrf and report the returned ids and scores before you write any retrieval code.
RUN THIS XERJ COMMAND curl -fsSL https://xerj.org/get | sh Install the single XERJ binary.
RUN THIS XERJ COMMAND curl -s -XPUT 'http://127.0.0.1:9200/docs' -H 'content-type: application/json' -d '{"mappings":{"properties":{"title":{"type":"text"},"text":{"type":"semantic_text"}}}}' One index holds the text and its vector. XERJ adds a companion text_vector field for you.
RUN THIS XERJ COMMAND curl -s -XPOST 'http://127.0.0.1:9200/docs/_search' -H 'content-type: application/json' -d '{"query":{"match":{"text":"how does the index recover after a restart"}},"size":3}' Keyword (BM25) retrieval on the same index, with no vectors involved.

What RAG actually needs

Retrieval augmented generation has two steps. A retriever finds a few passages that answer the question, and the model writes its answer from those passages. The retriever is the only part that touches your data, and nothing says it has to be a vector store.

Vector databases became the default because embeddings match meaning, so a question phrased in new words still finds the right passage. Keyword search matches exact terms, which is what you want for names, product codes, error strings and identifiers. In the SciFact run below, keyword search alone came close to hybrid search, so it makes a fair first step, and adding vectors later is a tuning step rather than a rebuild.

Route 1: keyword search with BM25

BM25 ranks passages by how often the query words appear in them, weighted so rare words count more than common ones. SQLite ships it: an FTS5 table plus the built-in bm25() function is a full retriever in one file.

CREATE VIRTUAL TABLE chunks USING fts5(source UNINDEXED, body);
SELECT source, body FROM chunks
WHERE chunks MATCH 'restart OR recover'
ORDER BY bm25(chunks) LIMIT 3;

Split documents into short chunks, store each with its source path, and pass the top three to the model with an instruction to answer only from them. A search engine such as XERJ does the same over folders of files, logs or code without any schema work. For a full local setup, see local RAG.

Route 2: use the document's structure

Manuals, policies and reports already carry an index: their headings and table of contents. Vectorless RAG tools give the model that outline, let it pick the sections that look relevant, then read those sections in full. This suits long, well-structured documents, and it costs more model calls per question than a single search.

Route 3: one search engine with vectors inside

When paraphrased questions matter, you can still skip the separate vector database. XERJ stores the text and its embedding in the same index. A semantic_text field gets a companion <field>_vector at write time, and one hybrid request fuses a BM25 sub-query and a kNN sub-query with Reciprocal Rank Fusion.

{"query":{"hybrid":{"queries":[
  {"query":{"match":{"text":"how does the index recover after a restart"}},"weight":1.0},
  {"query":{"knn":{"field":"text_vector","k":3,"num_candidates":50,"query_vector":[]}},"weight":1.0}],
  "fusion":"rrf"}},"size":3}

The empty array marks where the query vector goes. XERJ takes a literal float array, so index the query text into a semantic_text field and read its companion vector back from _source. The default embedder is lexical feature hashing; start the node with --embed-mode neural for a MiniLM-class model.

Recorded run: BEIR SciFact, 300 queries

nDCG@10, higher is better

  • BM25 only0.6572
  • Vectors only (MiniLM)0.6764
  • Hybrid, RRF0.6993
From benchmarks/beir-hybrid/results/scifact.txt in the XERJ repository: xerj v1.0.0-rc.74 with --embed-mode neural (all-MiniLM-L6-v2), one node, run on 2026-09-18. Bars start at 0 and the full width is 1.0. The measured nDCG page has the NFCorpus run and the method.

On SciFact, 300 queries, all three modes ran on one node. BM25 alone scored 0.0421 below hybrid, which is why keyword search is a strong first step. Hybrid search added the last gain without a second service. More on the method is in hybrid search.

Which route to pick

Start with BM25 when your questions use the same words as your documents, which is common for code, logs, tickets and internal docs. Pick structure-based retrieval for a handful of long, well-organized documents. Add vectors in the same index when users ask in their own words and you have measured that keyword search misses them. If your agent already runs grep, see when grep is the right retriever.

Try it

Copy the prompt on this page into your coding agent. It starts one XERJ node, loads your corpus, runs one hybrid request and reports the ids and scores, so you can compare keyword, vector and fused results on your own data before writing any retrieval code.

More comparisons: RAGFlow alternatives 2026.

FAQ

Can you do RAG without a vector database?

Yes. RAG needs a retriever, not a vector database. BM25 keyword search, document structure, or a search engine that stores vectors beside the text all work as the retrieval step.

Is RAG without embeddings good enough?

Often, yes. On BEIR SciFact our BM25 run scored nDCG@10 0.6572 against 0.6764 for vectors alone. Exact names, codes and error strings are where keyword search shines.

What is vectorless RAG?

RAG where retrieval uses keyword search or the document's own structure, such as headings and a table of contents, instead of embeddings in a vector store.

When do vectors help?

When users phrase questions differently from the source text. Hybrid search runs BM25 and vectors together and fuses them, and on SciFact that scored 0.6993.

Does XERJ need a separate vector database?

No. XERJ stores the dense vector beside the inverted index in one index, and one _search request queries both.

Is the default XERJ embedder semantic?

The default is lexical feature hashing with no model download. Run the node with --embed-mode neural to use a MiniLM-class embedder.

Evidence

Related