0

I am using Apache Solr for my search functionality and I have encountered an unexpected behavior with the boost parameter in the eDisMax query parser. When I try to boost the score of the documents matching a certain query, the scores are getting boosted by the square of the boost value, rather than the expected linear boost.

Here is an example of the query I'm using:

select?q=_query_:"{!edismax}shirt"&qt=search.new&fl=score&boost=10

I expected this query to return the same documents as before but with their scores boosted by a factor of 10. However, the scores for all the documents are now 100 times greater. I have noticed the same behavior when trying different boost values, and in every case, the scores are getting boosted by the square of the boost value.

Can someone please explain why this is happening? Is this the default behavior of the boost parameter in eDisMax? Is there a way to achieve linear multiplicative score boosting instead?

sehe
  • 374,641
  • 47
  • 450
  • 633
Sumit Raj
  • 11
  • 2

1 Answers1

0

The boost gets applied twice because of _query_ being wrapped inside q - the boost gets applied both in the inner query and when the main query (q) is applied to that result again. Since boost is multiplicative, that effectively means that you apply it twice and the value gets squared.

You can either provide the boost value to the inner edismax query directly in the local param ({!edismax boost=10}) or apply it globally and disable it in the internal query.

The actual answer will depend on why you have the inner query and what other parts are included outside of _query_ in your main query (since I can't really think of a reason to just have _query_ as the sole thing inside q).

MatsLindh
  • 49,529
  • 4
  • 53
  • 84