SOLR-6623: Fixing NPE in StoredFieldsShardResponseProcessor when using timeAllowed

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1633053 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Anshum Gupta 2014-10-20 06:10:08 +00:00
parent 72df721236
commit 788d519b89
2 changed files with 14 additions and 0 deletions

View File

@ -19,6 +19,7 @@ package org.apache.solr.handler.component;
import org.apache.lucene.index.ExitableDirectoryReader;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.params.CommonParams;
@ -244,6 +245,17 @@ public class SearchHandler extends RequestHandlerBase implements SolrCoreAware ,
}
} catch (ExitableDirectoryReader.ExitingReaderException ex) {
log.warn( "Query: " + req.getParamString() + "; " + ex.getMessage());
SolrDocumentList r = (SolrDocumentList) rb.rsp.getValues().get("response");
if(r == null)
r = new SolrDocumentList();
r.setNumFound(0);
rb.rsp.add("response", r);
if(rb.isDebug()) {
NamedList debug = new NamedList();
debug.add("explain", new NamedList());
rb.rsp.add("debug", debug);
}
rb.rsp.getResponseHeader().add("partialResults", Boolean.TRUE);
} finally {
SolrQueryTimeoutImpl.reset();
}

View File

@ -120,6 +120,8 @@ public class TopGroupsShardResponseProcessor implements ShardResponseProcessor {
continue; // continue if there was an error and we're tolerant.
}
NamedList<NamedList> secondPhaseResult = (NamedList<NamedList>) srsp.getSolrResponse().getResponse().get("secondPhase");
if(secondPhaseResult == null)
continue;
Map<String, ?> result = serializer.transformToNative(secondPhaseResult, groupSort, sortWithinGroup, srsp.getShard());
int numFound = 0;
float maxScore = Float.NaN;