Skip to navigation

Hybrid Search

Combine vector and full-text search in a single request using multi-query and RRF reranking.

Overview

Hybrid search issues multiple sub-queries concurrently and merges the results into a single ranked list. This is useful when neither pure vector nor pure BM25 search captures all the relevant documents.

Multi-query with RRF

Use the multi-query endpoint to combine a vector search and a BM25 search, merged with Reciprocal Rank Fusion (RRF):

const results = await client.namespaces.query("my-namespace", {
queries: [
{ rankBy: ["vector", "ANN", queryVector], topK: 20 },
{ rankBy: ["content", "BM25", "search query"], topK: 20 },
],
rerankBy: ["RRF"],
topK: 10,
});

RRF parameters

RRF can be tuned with a rank_constant (k):

rerankBy: ["RRF", { rankConstant: 60 }]

Higher values reduce the influence of high-ranking documents from a single sub-query. Defaults to 60.

  • Keyword + semantic intent: a user query like “fast object storage database” benefits from both BM25 (exact keyword matching) and ANN (semantic similarity).
  • Sparse + dense vectors: combine SparseKNN (e.g. from SPLADE) with ANN for state-of-the-art retrieval.
  • Multi-field ranking: search across separate text fields simultaneously and merge the results.