cpoerschke commented on code in PR #2248:
URL: https://github.com/apache/solr/pull/2248#discussion_r1494820258


##########
solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java:
##########
@@ -1731,6 +1738,19 @@ private void getDocListC(QueryResult qr, QueryCommand 
cmd) throws IOException {
     }
   }
 
+  private Relation populateScoresIfNeeded(
+      QueryCommand cmd, boolean needScores, TopDocs topDocs, Query query, 
ScoreMode scoreModeUsed)
+      throws IOException {
+    if (cmd.getSort() != null && !(cmd.getQuery() instanceof RankQuery) && 
needScores) {
+      TopFieldCollector.populateScores(topDocs.scoreDocs, this, query);
+    }
+    if (scoreModeUsed == ScoreMode.COMPLETE || scoreModeUsed == 
ScoreMode.COMPLETE_NO_SCORES) {
+      return TotalHits.Relation.EQUAL_TO;
+    } else {
+      return topDocs.totalHits.relation;
+    }
+  }
+

Review Comment:
   Proposing to factor out a method like this -- see #2280 -- which can then be 
called from all four places. I'm happy to resolve any merge conflicts that may 
arise here if #2280 is merged first.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to