Skip to main content
Hybrid search combines vector similarity with a database-specific lexical search signal.

How It Works

The implementation depends on the vector database. A hybrid search generally:
  1. Computes a vector similarity signal.
  2. Computes a lexical signal from the query and document text.
  3. Combines or fuses the signals into one ranking.
PgVector combines normalized vector similarity and PostgreSQL full-text ranking in one query. Set vector_score_weight between 0 and 1 to control their relative contribution. The default is 0.5. Chroma runs vector search and a lexical candidate search, then merges their rankings with Reciprocal Rank Fusion (RRF). Its lexical path filters on the first query token and scores term overlap.
Each vector database maps SearchType.hybrid to its own query and ranking algorithm. Check the selected integration before tuning retrieval.
Evaluate the available search types against representative queries and expected documents. Ranking behavior also depends on the embedder, content, chunking strategy, and database configuration.

Configuration

Basic Setup

With Reranking

Apply a reranker to the fused candidates:

Chroma RRF Constant

For Chroma, hybrid_rrf_k controls how strongly rank position affects the fused score. Higher values reduce the difference between adjacent ranks. The default is 60.

Example

Install the dependencies used on this page and start a PostgreSQL instance with pgvector enabled:
hybrid_search.py

Supported Vector Databases

Developer Resources