You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Dawn <li...@live.com> on 2020/11/03 05:59:36 UTC

SolrIndexSearcher RankQuery Score calculation

Hi:

SolrIndexSearcher.getDocListNC and getDocListAndSetNC code snippet:

if (cmd.getSort() != null && query instanceof RankQuery == false && (cmd.getFlags() & GET_SCORES) != 0) {
  TopFieldCollector.populateScores(topDocs.scoreDocs, this, query);
}


When this query includes a filterQuery, `QueryUtils.combineQueryAndFilter` will build A new BooleanQuery and copy it to the Query object。
so `query instanceof RankQuery` is false, This causes the score to be lost in the RankQuery phase.

Can you change this to determine if the original query is RankQuery: 
`cmd.getQuery() instanceof RankQuery`. 


version 8.6.*, 9.*