Every RAG tutorial says the same thing: "Just combine vector search with Postgres full-text search using Reciprocal Rank Fusion (RRF)."

I actually measured it on 300 judged scientific-claim queries (BEIR SciFact, 5,183 abstracts). Two things jumped out immediately:

  1. The standard plainto_tsquery + ts_rank_cd query shown in many hybrid-search READMEs returned zero rows on 277 out of 300 queries.
  2. Even after fixing the SQL query, RRF with Postgres ts_rank scored 0.6809 nDCG@10 — no better than plain BM25 alone (0.6854). Swapping the keyword half to real BM25 pushed RRF to 0.7168, beating both legs cleanly.

TL;DR

  • RRF (Dense + BM25): 0.7168 nDCG@10 (+0.0314 over BM25, +0.0684 over Dense; 95% bootstrap intervals exclude zero).
  • RRF (Dense + Postgres ts_rank OR-query): 0.6809 nDCG@10 — beats Dense (0.6484) and Postgres alone (0.5807), but cannot beat standalone BM25 (0.6854).
  • Qdrant's server-side RRF given the same dense + BM25 sparse vectors scored the exact same 0.7168 (and DBSF scored 0.7278).
  • The fusion formula (k=1 vs k=60 vs k=200 vs min-max score fusion) barely mattered. The quality of the keyword leg decided the outcome.

Test Bench

  • Dataset: BEIR SciFact — 5,183 scientific abstracts, 300 test claims, 339 human-judged relevant abstracts.
  • Database: PostgreSQL 15.14 (tsvector with english config + GIN index).
  • Embeddings: sentence-transformers/all-MiniLM-L6-v2 (384d, first 256 tokens, normalized, exact cosine scan in NumPy at 0.42 ms/query so there is zero ANN recall loss).
  • BM25: rank_bm25 (BM25Okapi, k1=1.5, b=0.75, English stop words removed + Snowball stemmer).
  • Metrics: nDCG@10, Recall@10, Recall@100, plus 95% paired bootstrap confidence intervals (10,000 resamples).

1. The Postgres plainto_tsquery Trap (277 Empty Queries)

plainto_tsquery joins every query term with AND. On natural-language questions or claims, almost no single document contains every single word — so 277 of 300 queries returned zero rows (nDCG@10 = 0.0703).

Turning AND (&) into OR (|) brings results back:

WITH x AS ( SELECT replace( plainto_tsquery('english', 'biomaterials show inductive properties')::text, ' & ', ' | ' )::tsquery AS q ) SELECT n FROM docs, x WHERE tsv @@ x.q ORDER BY ts_rank(tsv, x.q) DESC LIMIT 100; 

Watch what happened to latency and ranking quality across Postgres's built-in rankers (each OR query matched a median of 2,563 of the 5,183 abstracts):

Postgres query shape nDCG@10 Recall@10 Median latency
plainto_tsquery (AND) 0.0703 0.0694 0.27 ms (277/300 empty)
OR terms + ts_rank 0.5807 0.7138 22.91 ms
OR terms + ts_rank(..., 1) 0.6031 0.7247 —
OR terms + ts_rank(..., 2) 0.3490 0.4823 —
OR terms + ts_rank_cd 0.3398 0.5056 89.08 ms

Notice two things:

  • ts_rank_cd (cover density) was both the slowest (89.08 ms) and worst-scoring (0.3398) on sentence-length claims.
  • As the PostgreSQL docs note, ts_rank uses no global corpus statistics (no IDF). That is why BM25 — which down-weights common words across the collection — jumped to 0.6854 nDCG@10 (+0.1047 over ts_rank).

2. Fusing With RRF (and Why k Barely Mattered)

Here is the entire 6-line RRF function used over the top 100 from each leg:

def rrf(ranked_lists: list[list[int]], k: int = 60) -> list[int]: scores: dict[int, float] = {} for ranked in ranked_lists: for pos, doc_id in enumerate(ranked): scores[doc_id] = scores.get(doc_id, 0.0) + 1.0 / (k + pos + 1) return sorted(scores, key=scores.get, reverse=True)[:100] 

Full comparison across single legs and fused runs:

Run nDCG@10 Recall@10 Recall@100
Dense MiniLM (exact cosine) 0.6484 0.7883 0.9250
BM25 (rank_bm25) 0.6854 0.8235 0.9260
Postgres ts_rank (OR) 0.5807 0.7138 0.8489
RRF: Dense + BM25 0.7168 0.8503 0.9550
RRF: Dense + Postgres ts_rank 0.6809 0.8021 0.9393
RRF: Dense + Postgres ts_rank_cd 0.5923 0.7320 0.9367
Min-max score fusion (0.5 / 0.5, Dense + BM25) 0.7205 0.8433 0.9550

The 95% paired bootstrap intervals confirm what is real and what is noise:

  • RRF (Dense + BM25) − BM25: +0.0314 (95% CI: 0.0090 to 0.0545) → real gain.
  • RRF (Dense + BM25) − Dense: +0.0684 (95% CI: 0.0460 to 0.0917) → real gain.
  • RRF (Dense + Postgres) − BM25: −0.0046 (95% CI: −0.0306 to 0.0207) → indistinguishable from BM25 alone.
  • Score fusion − RRF: +0.0037 (95% CI: −0.0117 to 0.0191) → noise.
  • Sweeping k from 1 to 200 moved nDCG@10 by at most 0.0029 (0.7163–0.7192).

3. Running the Exact Same Fusion Inside Qdrant

Using qdrant-client 1.20.0 (local in-memory mode) with named dense + bm25 sparse vectors and two models.Prefetch(..., limit=100) calls:

Qdrant run (local mode) nDCG@10 Recall@10 Recall@100
Dense only 0.6484 0.7883 0.9250
Sparse BM25 only 0.6857 0.8235 0.9260
Hybrid RRF (default k) 0.7174 0.8483 0.9550
Hybrid RRF (k=60) 0.7168 0.8503 0.9550
Hybrid DBSF 0.7278 0.8567 0.9550

Qdrant's RRF (k=60) matched my hand-written Python function to four decimal places (0.7168, top-10 overlap 0.998). Qdrant's DBSF scored 0.7278, though its +0.0104 edge over default RRF had a 95% CI (−0.0038 to 0.0250) crossing zero. (For a full Qdrant + FastEmbed production setup, see Qdrant hybrid search in Python.)

4. Practical Takeaways

  • Do not copy-paste plainto_tsquery + ts_rank_cd for sentence-length RAG queries. Convert to OR (or use websearch_to_tsquery carefully) and prefer ts_rank(..., 1) over ts_rank_cd — or better yet, use real BM25 (e.g., ParadeDB pg_search in Postgres or sparse BM25 in Qdrant).
  • Stop over-tuning RRF's k. Moving k between 1 and 200 barely moved the needle; upgrading the keyword leg from ts_rank to BM25 was worth +0.0359 nDCG@10 in the hybrid.

Limits of This Benchmark

One scientific-claim dataset (300 queries), one small 384d model, default BM25 parameters, exact NumPy cosine (no pgvector ANN loss), and Qdrant local mode rather than a networked Qdrant server. Short 2–3 word keyword queries and cross-encoder rerankers were not tested.

Full tables, bootstrap intervals, and per-query win/loss breakdown: aiandsoftwarehub.com.

If you run hybrid search in Postgres: Are you using built-in tsvector/ts_rank, or did you install a BM25 extension like pg_search?