Cross-Engine Fusion (RRF)
Reciprocal Rank Fusion merges ranked results from two engines into a single result set. No application-level merging needed. Two pairwise fusions are supported: vector + BM25 text via rrf_score(...), and vector + graph via either GRAPH RAG FUSION ON ... or SEARCH ... USING FUSION(...).
How RRF Works
For each result, compute: score = Σ 1 / (k + rank_i) where k is a constant (default 60) and rank_i is the result's rank from each source.
Vector + Full-Text
SELECT title, rrf_score(
vector_distance(embedding, $query_vec),
bm25_score(body, 'distributed database')
) AS score
FROM articles
LIMIT 10;
GraphRAG (Vector + Graph)
GRAPH RAG FUSION ON entities
QUERY ARRAY[0.1, 0.3, -0.2, ...]
VECTOR_FIELD 'embedding'
VECTOR_TOP_K 50
EXPANSION_DEPTH 2
EDGE_LABEL 'related_to'
FINAL_TOP_K 10
RRF_K (60.0, 35.0);
Equivalent shorthand:
SEARCH entities USING FUSION(
ARRAY[0.1, 0.3, -0.2, ...]
VECTOR_FIELD 'embedding' VECTOR_TOP_K 50
DEPTH 2 LABEL 'related_to'
TOP 10 RRF_K (60.0, 35.0)
);
Vector search finds seed nodes, graph BFS expands context, RRF merges both rankings.
Three-Source Fusion (Vector + Text + Graph)
When you want vector similarity, BM25 text relevance, and graph context all merged in one pass, add the BM25 '<query>' ON '<field>' leg to the SEARCH … USING FUSION DSL. The RRF_K tuple becomes a triple.
SEARCH entities USING FUSION(
ARRAY[0.1, 0.3, -0.2, ...]
VECTOR_FIELD 'embedding' VECTOR_TOP_K 50
BM25 'transformer attention' ON 'body'
DEPTH 2 LABEL 'related_to'
TOP 10 RRF_K (60.0, 35.0, 50.0)
);
The three RRF_K values correspond to the vector leg, the graph expansion leg, and the BM25 leg respectively. When all three are present the planner routes through the three-source RRF plan variant.
The two-source GRAPH RAG FUSION ON … BM25 '…' ON '…' form also accepts the extra text leg inline:
GRAPH RAG FUSION ON entities
QUERY $embedding VECTOR_FIELD 'embedding' VECTOR_TOP_K 50
BM25 'transformer attention' ON 'body'
EXPANSION_DEPTH 2 EDGE_LABEL 'related_to' FINAL_TOP_K 10
RRF_K (60.0, 35.0, 50.0);
Cross-Model Queries
All engines share the same snapshot. A query that combines vector similarity, graph traversal, spatial filtering, and document field access sees a consistent point-in-time view.
-- Spatial filter → vector rank → document fields
SELECT name, vector_distance(embedding, $vec) AS sim
FROM restaurants
WHERE ST_DWithin(location, ST_Point(-73.99, 40.75), 2000)
AND embedding <-> $vec
LIMIT 10;