madrob commented on a change in pull request #267:
URL: https://github.com/apache/solr/pull/267#discussion_r693053694



##########
File path: 
solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
##########
@@ -955,9 +955,12 @@ protected void mergeIds(ResponseBuilder rb, ShardRequest 
sreq) {
 
         @SuppressWarnings("unchecked")
         NamedList<List<Object>> sortFieldValues = 
(NamedList<List<Object>>)(srsp.getSolrResponse().getResponse().get("sort_values"));
-        if ((null == sortFieldValues || sortFieldValues.size()==0) && // we 
bypass merging this response only if it's partial itself
-                            thisResponseIsPartial) { // but not the previous 
one!!
-          continue; //fsv timeout yields empty sort_vlaues
+        if (null == sortFieldValues) {
+          sortFieldValues = new NamedList<>();
+        }
+        // skip merging results for this shard if the sortSpec includes a 
non-scoredoc field but the sortFieldValues is empty.
+        if (thisResponseIsPartial && sortFieldValues.size() == 0 && 
ss.includesNonScoreOrDocField()) {

Review comment:
       it's interesting to me that we do a similar check later on line 1122, 
not sure if we can combine or remove some of this logic.

##########
File path: solr/core/src/java/org/apache/solr/search/SortSpec.java
##########
@@ -76,6 +76,18 @@ public boolean includesScore() {
     return includesScore(sort);
   }
 
+  public boolean includesNonScoreOrDocField() {
+    return includesNonScoreOrDocField(sort);
+  }
+
+  public static boolean includesNonScoreOrDocField(Sort sort) {

Review comment:
       nit: add javadoc please




-- 
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: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to