risdenk commented on code in PR #1026:
URL: https://github.com/apache/solr/pull/1026#discussion_r975504508
##########
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:
Added `SolrResponseUtil` and tried to address a bunch of other places this
could come up.
--
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]