Hybrid search combines vector similarity search with full-text search to retrieve both semantically related passages and passages containing precise keywords. It improves a basic RAG retriever when either method alone misses useful context. section 2.3 section 2.5
A practical hybrid-search pipeline follows these steps:
- Run a vector-index query with the question embedding and a full-text query with the original question. section 2.3.2
- Normalize each result set by dividing scores by that search’s highest score, making the scores comparable. section 2.3.2
- Union the results, deduplicate nodes, retain each node’s maximum score, sort descending, and return the top k records. section 2.3.2
- Feed the retrieved passages to the generator, then evaluate quality, accuracy, and performance rather than assuming combined retrieval is sufficient. section 2.4
Neo4j retrieval for an Einstein question
A Neo4j query searches the pdf vector index and ftPdfChunk full-text index with k = 4, normalizes both score streams, merges matching nodes, and returns passages. For a question about Einstein’s upbringing, inventions, and patents, the combined results include a passage about his manufacturer father, machines, instruments, and laboratory work, followed by another Einstein passage. section 2.3.2
Listing 2.13 Performing hybrid search in Neo4j
hybrid_query = '''
CALL {
// vector index
CALL db.index.vector.queryNodes('pdf', $k, $question_embedding)
YIELD node, score
WITH collect({node:node, score:score}) AS nodes, max(score) AS max
UNWIND nodes AS n
// Normalize scores
RETURN n.node AS node, (n.score / max) AS score
UNION
// keyword index
CALL db.index.fulltext.queryNodes('ftPdfChunk', $question, {limit: $k})
YIELD node, score
WITH collect({node:node, score:score}) AS nodes, max(score) AS max
UNWIND nodes AS n
// Normalize scores
RETURN n.node AS node, (n.score / max) AS score
}
// deduplicate nodes
WITH node, max(score) AS score ORDER BY score DESC LIMIT $k
RETURN node, score
'''
Inspect the complete Cypher implementation for querying both indexes, normalizing scores, deduplicating nodes, ordering matches, and limiting the final result set. section 2.3.2







