Boost a term
Boosting a term assigns more relevance to a word or phrase.
By default, all terms have equal value when the relevance score of a matching document is computed. Boosting a term raises the score of a document that contains it above the score of documents that do not. The search results are the same, but when sorted in descending order by score, documents containing the boosted term appear higher in the results.
To boost a term, use the caret symbol (^) followed by a number for the boost factor after the term that you want to appear more relevant. By default the boost factor is 1. It must be a positive number, but it can be less than one: for example .3 or .5.
For example, if your search terms are Windows
and UNIX
as
in the search predicate bts_contains(column, ' Windows
UNIX ')
, you can boost the term Windows
by
a factor of 4:
bts_contains(column, ' Windows^4 UNIX ')
This example boosts the phrase road bike
over
the phrase mountain bike
by a factor of 2:
bts_contains(column, ' "road bike"^2 "mountain bike" ')
You can also boost more than one term in a query. This example
would return rows with the term lake
before documents
with the term land
, before documents with the term air
.
bts_contains(column, ' lake^20 land^10 air ')