Support Questions
Find answers, ask questions, and share your expertise

Solr search confidence score


Solr search confidence score

New Contributor


How to find confidence score in Solr search? 
Our requirement is corresponding to every record we need to find the probable matches and also displaying them based on confidence score so that most likely record is displayed first and so on. 

Please suggest how it can be achieved in Solr search.Thanks!


Re: Solr search confidence score

Cloudera Employee


We believe the score that is appearing for more than one shard collection is based on local shard information and as a result not from the complete collection as together. We believe that we can fix this by adding this specific parameter[1] in solrconfig.xml:
<statsCache class=""/> 

This provides all the stats from a global(within the collection) perspective rather than a local(within a shard) perspective.

Link explains how this parameter works "ExactStatsCache: This implementation uses global values (across the collection) for document frequency."

We suggest the following Plan of Action:
- First download the config of the collection that you want to modify: solrctl instancedir --get <conifg_name> /tmp/<config_name>
- Then modify the solrconfig.xml by adding the following parameter " <statsCache class=""/>  ": vi /tmp<config_name>/conf/solrconfig.xml
- Then upload the config in zookeeper: solrctl instancedir --update <config_name> /tmp/<config_name>
- Then reload the collection so that the changes can take effect: solrctl collection --reload <collection_name>
- Re run the query and let us know if this solution works.