diff --git a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java index c26a72df2fe..5db23a5d391 100644 --- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java +++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java @@ -2288,10 +2288,9 @@ public ScoreMode scoreMode() { } populateNextCursorMarkFromTopDocs(qr, cmd, topDocs); - // if (cmd.getSort() != null && !(cmd.getQuery() instanceof RankQuery) && - // needScores) { - // TopFieldCollector.populateScores(topDocs.scoreDocs, this, query); - // } + if (cmd.getSort() != null && !(cmd.getQuery() instanceof RankQuery) && needScores) { + TopFieldCollector.populateScores(topDocs.scoreDocs, this, query); + } // nDocsReturned = topDocs.scoreDocs.length; // TODO: Is this correct? // hitsRelation = topDocs.totalHits.relation; diff --git a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java index 7b99a95fe21..fb3a1137734 100644 --- a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java +++ b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java @@ -1786,7 +1786,7 @@ private void testMinExactCount() throws Exception { CommonParams.ROWS, "200", CommonParams.SORT, - "id asc"); + "score desc, id asc"); assertIsExactHitCount( "q", "{!cache=false}id:1", CommonParams.MIN_EXACT_COUNT, "1", CommonParams.ROWS, "1"); assertApproximatedHitCount(