Constant Boosting

The ^ operator is used to boost the scores of individual fields by a constant. In the following query, description is weighted twice as heavily as category in the final BM25 score.

SELECT id, paradedb.score(id)
FROM mock_items
WHERE description @@@ 'shoes^2' OR category @@@ 'footwear'
ORDER BY score DESC
LIMIT 5;

Boosting by Field

The following query boosts the score of each row by multiplying it by the row’s rating. This means that items with the same score but a higher rating will score higher overall.

SELECT id, paradedb.score(id) * COALESCE(rating, 1) as score
FROM mock_items
WHERE description @@@ 'shoes'
ORDER BY score DESC
LIMIT 5;
COALESCE sets NULL values of rating to 1.