Solr boosts result by field value

I am requesting a solr server for locations. These location documents also have a "country_code" field that contains values ​​such as US, GB, DE, ...

In certain circumstances, I want to improve results using specific country codes so that I can prioritize my results by country.

For instance:

?q=york 

Let's say a user from the UK is looking for York ... At that moment, he first finds in New York in the USA, and then in England.

I want to be able to indicate that for this query, British results should be on top. I found that this should be possible through dismax and bq, something like this:

 ?q=york&dismax=true&bq=country_code:GB^20.0 

But this does not work as expected, now York from Guatemala (country_code GT) is on top, GB is not visible.

Help me please: -)

+4
source share
2 answers

Well, what I did with fatigue in my question works, I just have a too high level of promotion. Changed it from 20 to 20,000, and it works great.

+5
source

The bq paramax parameter is additive, which means adding to the final result. The new edismax parser has a boost parameter that multiplies the value of the boost function by the final result, edismax boost .

+6
source

Source: https://habr.com/ru/post/1415545/


All Articles