Tutorials
Hybrid Search
ParadeDB’s full text and similarity search APIs can be combined in the same query to execute hybrid search.
This guide uses the mock_items
table, which was created in the quickstart. It assumes that the entire
quickstart tutorial has been completed, including the vector search section.
Reciprocal Rank Fusion
Reciprocal rank fusion is a popular hybrid search algorithm that:
- Calculates a BM25 and similarity score for the top
n
documents. - Ranks documents by their BM25 and similarity scores separately. The highest-ranked document for each score receives an
r
of1
. - Calculates a reciprocal rank for each score as
1/(k + r)
, wherek
is a constant.k
is usually set to60
. - Calculates each document’s reciprocal rank fusion score as the sum of the BM25 and similarity reciprocal rank scores.
The following code block implements reciprocal rank fusion over the mock_items
table. BM25 scores are calculated against the query description:keyboard
and similarity scores are
calculated against the vector [1,2,3]
.
Here, we see that the top five results either contain keyboard
in the description
field or have an embedding
of [1,2,3]
.
Was this page helpful?