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/19 17:53:43 UTC

[GitHub] [solr] epugh commented on a diff in pull request #1025: SOLR-16417: NPE if facet query hits timeout or exception

epugh commented on code in PR #1025:
URL: https://github.com/apache/solr/pull/1025#discussion_r974524263


##########
solr/core/src/java/org/apache/solr/handler/component/FacetComponent.java:
##########
@@ -862,6 +839,42 @@ private void countFacets(ResponseBuilder rb, ShardRequest sreq) {
     removeQueryFacetsUnderLimits(rb);
   }
 
+  private static NamedList<?> getFacetCountsFromShardResponse(
+      ResponseBuilder rb, ShardResponse srsp) {
+    NamedList<?> facet_counts;
+    try {
+      SolrResponse solrResponse = srsp.getSolrResponse();
+      NamedList<Object> response = solrResponse.getResponse();
+      facet_counts = (NamedList<?>) response.get(FACET_COUNTS_KEY);
+      if (facet_counts != null) {
+        return facet_counts;
+      } 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(
+              ErrorCode.SERVER_ERROR,
+              FACET_COUNTS_KEY
+                  + " is absent in response from "
+                  + srsp.getNodeName()
+                  + ", but "
+                  + SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY
+                  + " hasn't been responded");

Review Comment:
   wording??   `hasn't responded` maybe?  Trying to figure out the wording!



-- 
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