From 048721d9dc1f49df877cbc2533f4f294e7e73d0f Mon Sep 17 00:00:00 2001 From: Erick Erickson Date: Thu, 15 Mar 2012 17:12:42 +0000 Subject: [PATCH] Fix for SOLR-3196 git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1301097 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/solr/handler/component/QueryComponent.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java index cfd0b9bb0d6..18c305f11fc 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java +++ b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java @@ -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) {