Solr Boost on request without request

All my results are of the type “active, inactive, historical” - this is a field indexed by Solr.

I want my results to go back up to type = "active" .

I could make an order, which is enough, but not so much.

Thus, when a user searches for the term “patient”, he gets the most important results for patients, but with a higher promotion for documents in which he is active.

Not just a sorted result set!

+4
source share
2 answers

You can use edismax parser and the following boost bq query to get the desired results, which will be pushed to the top ..

  http://localhost:8983/solr/select/?q=sick&defType=edismax&bq=type:active^5.0 

In this example, you add a promotion request to increase the relevance of documents whose type is active.

Here are some more examples on the Solr Wiki DisMaxQParserPlugin page .

+5
source

In the above example, an additional increment will be created. If you want a multiplier boost for "type = active", you can add:

&boost=if(termfreq(type,"active"),2,1)

Which gives an increase in coefficient 2 for "type = active"

+3
source

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


All Articles