Fix for SOLR-3196

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1301097 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erick Erickson 2012-03-15 17:12:42 +00:00
parent 1e7f863f38
commit 048721d9dc
1 changed files with 9 additions and 0 deletions

View File

@ -780,6 +780,7 @@ public class QueryComponent extends SearchComponent
long numFound = 0;
Float maxScore=null;
boolean partialResults = false;
for (ShardResponse srsp : sreq.responses) {
SolrDocumentList docs = null;
@ -816,6 +817,11 @@ public class QueryComponent extends SearchComponent
docs = (SolrDocumentList)srsp.getSolrResponse().getResponse().get("response");
}
NamedList<?> responseHeader = (NamedList<?>)srsp.getSolrResponse().getResponse().get("responseHeader");
if (responseHeader != null && Boolean.TRUE.equals(responseHeader.get("partialResults"))) {
partialResults = true;
}
// calculate global maxScore and numDocsFound
if (docs.getMaxScore() != null) {
maxScore = maxScore==null ? docs.getMaxScore() : Math.max(maxScore, docs.getMaxScore());
@ -894,6 +900,9 @@ public class QueryComponent extends SearchComponent
// TODO: use ResponseBuilder (w/ comments) or the request context?
rb.resultIds = resultIds;
rb._responseDocs = responseDocs;
if (partialResults) {
rb.rsp.getResponseHeader().add( "partialResults", Boolean.TRUE );
}
}
private void createRetrieveDocs(ResponseBuilder rb) {