You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/09/20 14:10:33 UTC

[GitHub] [solr] risdenk commented on a diff in pull request #1026: SOLR-16418: SearchGroupsResultTransformer NPE during query timeout or exception

risdenk commented on code in PR #1026:
URL: https://github.com/apache/solr/pull/1026#discussion_r975417709


##########
solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/SearchGroupShardResponseProcessor.java:
##########
@@ -171,4 +174,43 @@ public void process(ResponseBuilder rb, ShardRequest shardRequest) {
       }
     }
   }
+
+  @SuppressWarnings("unchecked")
+  private static NamedList<NamedList<?>> getFirstPhaseFromShardResponse(
+      ResponseBuilder rb, ShardResponse srsp) {
+    NamedList<NamedList<?>> firstPhaseResult;
+    try {
+      SolrResponse solrResponse = srsp.getSolrResponse();
+      NamedList<?> response = solrResponse.getResponse();
+      firstPhaseResult = (NamedList<NamedList<?>>) response.get("firstPhase");
+      if (firstPhaseResult != null) {
+        return firstPhaseResult;
+      } else {
+        NamedList<?> responseHeader =
+            (NamedList<?>) response.get(SolrQueryResponse.RESPONSE_HEADER_KEY);
+        if (responseHeader.getBooleanArg(SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY)) {
+          return null;
+        } else {
+          log.warn("corrupted response on {} : {}", srsp.getShardRequest(), solrResponse);
+          throw new SolrException(
+              SolrException.ErrorCode.SERVER_ERROR,
+              "firstPhase"
+                  + " is absent in response from "
+                  + srsp.getNodeName()
+                  + ", but "
+                  + SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY
+                  + " isn't set in the response.");
+        }
+      }
+    } catch (Exception ex) {
+      if (ShardParams.getShardsTolerantAsBool(rb.req.getParams())) {
+        return null;
+      } else {
+        throw new SolrException(
+            SolrException.ErrorCode.SERVER_ERROR,
+            "Unable to read facet info for shard: " + srsp.getShard(),

Review Comment:
   Yea you came to the same conclusion I did. I'll see what I can do to find a place to put this.



-- 
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-unsubscribe@solr.apache.org

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


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