mirror of https://github.com/apache/lucene.git
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:
parent
1e7f863f38
commit
048721d9dc
|
@ -780,6 +780,7 @@ public class QueryComponent extends SearchComponent
|
||||||
|
|
||||||
long numFound = 0;
|
long numFound = 0;
|
||||||
Float maxScore=null;
|
Float maxScore=null;
|
||||||
|
boolean partialResults = false;
|
||||||
for (ShardResponse srsp : sreq.responses) {
|
for (ShardResponse srsp : sreq.responses) {
|
||||||
SolrDocumentList docs = null;
|
SolrDocumentList docs = null;
|
||||||
|
|
||||||
|
@ -816,6 +817,11 @@ public class QueryComponent extends SearchComponent
|
||||||
docs = (SolrDocumentList)srsp.getSolrResponse().getResponse().get("response");
|
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
|
// calculate global maxScore and numDocsFound
|
||||||
if (docs.getMaxScore() != null) {
|
if (docs.getMaxScore() != null) {
|
||||||
maxScore = maxScore==null ? docs.getMaxScore() : Math.max(maxScore, docs.getMaxScore());
|
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?
|
// TODO: use ResponseBuilder (w/ comments) or the request context?
|
||||||
rb.resultIds = resultIds;
|
rb.resultIds = resultIds;
|
||||||
rb._responseDocs = responseDocs;
|
rb._responseDocs = responseDocs;
|
||||||
|
if (partialResults) {
|
||||||
|
rb.rsp.getResponseHeader().add( "partialResults", Boolean.TRUE );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createRetrieveDocs(ResponseBuilder rb) {
|
private void createRetrieveDocs(ResponseBuilder rb) {
|
||||||
|
|
Loading…
Reference in New Issue