---
title: Boosting
noindex: true
---

<Danger>
  **Legacy Docs:** This page describes our legacy API. It will be deprecated in
  a future version. Please use the [v2 API](/) where possible.
</Danger>

## 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.

```sql
SELECT id, pdb.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.

```sql
SELECT id, pdb.score(id) * COALESCE(rating, 1) as score
FROM mock_items
WHERE description @@@ 'shoes'
ORDER BY score DESC
LIMIT 5;
```

<Note>`COALESCE` sets `NULL` values of `rating` to `1`.</Note>
