BM25 Scoring
Basic Usage
BM25 scores measure how relevant a score is for a given query. Higher scores indicate higher relevance.
The paradedb.score(<key_field>)
function can be added to any query where an @@@
operator is present.
Sorting by a field with a limit other than paradedb.score()
, while returning paradedb.score()
in the query’s target
list defeat the “top N” optimization. The results will still be sorted by the specified field, but not as efficiently.
Joined Scores
The following query demonstrates how to compute a “combined BM25 score” over a joined search. It joins mock_items
with orders
,
which were both created in the quickstart.
Score Refresh
The scores generated by the BM25 index may be influenced by dead rows that have not been cleaned up by the VACUUM
process.
Running VACUUM
on the underlying table will remove all dead rows from the index and ensures that only rows visible to the current
transaction are factored into the BM25 score.
Was this page helpful?