1. The Complementary Strengths of Sparse and Dense Search
In modern enterprise information retrieval, neither pure lexical keyword search nor pure dense vector search is sufficient on its own. Vector search excels at broad conceptual semantic understanding, but struggles with exact SKU numbers, error codes, and unique medical drug brand names. BM25 lexical search pinpoints exact alphanumeric identifiers flawlessly, but fails when users use synonyms. Hybrid search combines both worlds.
2. Reciprocal Rank Fusion (RRF) Algorithm
Combining raw BM25 scores (which range from 0 to unbounded numbers) with cosine similarity scores (which range from -1 to 1) is problematic because their score distributions cannot be directly normalized. Reciprocal Rank Fusion (RRF) solves this by discarding raw scores and evaluating only the relative ranking positions of documents returned by each search engine: RRF_Score(d) = \sum \frac{1}{k + r_i(d)}, where k is a smoothing constant (typically 60).
3. Unified Hybrid Search in OpenSearch and PostgreSQL
Modern search engines support hybrid pipelines natively. In PostgreSQL using pgvector and pg_trgm, queries execute both full-text TS_RANK searches and vector cosine similarity queries in parallel, fusing top candidates into a unified result set. In OpenSearch 2.11+, neural search plugins combine lexical match queries with k-NN vector queries automatically in a single API call.
4. Real-World RAG Impact
Deploying hybrid search across enterprise documentation and hospital knowledge bases ensures that whether an engineer queries "what is the SLA for ticket resolution?" (conceptual) or "error code ERR_502_BAD_GATEWAY" (exact keyword), the retrieval engine consistently returns the correct authoritative documentation.