I would like to know how it is possible to get different scores for a multiple terms search result?
Certain results in solr have the same score even when there are multiple terms in the query as you will see in the example below.
I have two indexes in Solr, each containing: id, first_name, last_name Each index would look like the following:
<doc>
<str name="id">1</str>
<str name="last_name">fisher</str>
<str name="name">john</str>
</doc>
<doc>
<str name="id">2</str>
<str name="last_name">darby</str>
<str name="name">john</str>
</doc>
When I query just "john" both results come up. That is perfect. However, when I query "john fisher" both results come up but with the same score. What I want is different scores based on the relevancy of the search terms.
Here is the result for the following query http://localhost:8983/solr/select?q=john+fisher%0D%0A&rows=10&fl=*%2Cscore
<response>
...
<result name="response" numFound="2" start="0" maxScore="0.85029894">
<doc>
<float name="score">0.85029894</float>
<str name="id">1</str>
<str name="last_name">fisher</str>
<str name="name">john</str>
</doc>
<doc>
<float name="score">0.85029894</float>
<str name="id">2</str>
<str name="last_name">darby</str>
<str name="name">john</str>
</doc>
</result>
</response>
Any help would be greatly appreciated
Your best bet is to understand & analyse how different factors affect your document score, Lucene has helpful feature
Explanation
, Solr leverage this to provide how scoring is calculated you can use 'debugQuery' in Solr to see how it is derived,Ex Response:
besides this, you can use
explainOther
to find out how a certain document did not match the query.Do Read: