chimbu
chimbu

Reputation: 11

Solr cloud scoring happens inside shard and not in overall collection

In solr cloud scoring is calculated with in the shards.

I have a collection and two shards. I have 110 documents in shard1 and 90 documents in shard 2 matching a field name:John

The solr scoring for the document differs with shards and i need solr to calculate score with docs in overall collection and not with in shards and merging.

For example: Search for John returns 2 records with exact match and the scores are 3.2 and 2.2 . Is there any way to make scoring based on collection instead of shard

Upvotes: 0

Views: 586

Answers (2)

Alessandro Benedetti
Alessandro Benedetti

Reputation: 1114

You are interested in distributed IDF [1] . This will allow you to precisely score documents across the different shards on the basis of a same IDF.

keep in mind that even in this case "documents with exact match" can have different scores : 1) Different field length 2) Different term frequencies for the terms involved 3) Different boosts ( if applies)

Cheers [1] https://cwiki.apache.org/confluence/display/solr/Distributed+Requests

Upvotes: 1

Persimmonium
Persimmonium

Reputation: 15791

you have to enable ExactStatsCache in your solrconfig.xml like this:

<statsCache class="org.apache.solr.search.stats.ExactStatsCache"/>

by default Solr is using local stats only, this will make Solr use global stats for scoring, and should solve your issue.

Upvotes: 1

Related Questions