Example on how to boost a field?


#1

I am wondering whether one could boost certain fields (e.g., title and
keywords) to make them ‘weigh’ more against searches across all fields.

I know that Document::Field has a boost attribute and that it accepts a
boost argument in the constructor (although I’ve had not much luck with
it, I am just getting back exceptions upon init w/ boost), but I was
wondering whether the boost parameter could be set on the index or
search and not at indexing time on the doc field. Moreover, I see that
the default is set to 1.0 but what’s the max? What are reasonable values
for the boost parameter. How would boosting up to 1.1 or 10 or 100
affect the search results?

Thank you in advance for your consideration,

Dado


#2

Hi Dado,

Could you give an example of your code that is causing exceptions?

If you want to see the effect that a boost has on the results you can
use IndexSearcher#explain(query, doc) to see how the boost effects the
query score. There is no maximum or minimum value for the boost.

Hope that helps,
Dave