You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by an...@apache.org on 2014/10/20 08:10:08 UTC

svn commit: r1633053 - in /lucene/dev/trunk/solr/core/src/java/org/apache/solr: handler/component/SearchHandler.java search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java

Author: anshum
Date: Mon Oct 20 06:10:08 2014
New Revision: 1633053

URL: http://svn.apache.org/r1633053
Log:
SOLR-6623: Fixing NPE in StoredFieldsShardResponseProcessor when using timeAllowed

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java?rev=1633053&r1=1633052&r2=1633053&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java Mon Oct 20 06:10:08 2014
@@ -19,6 +19,7 @@ package org.apache.solr.handler.componen
 
 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 Reque
         }
       } 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();
       }

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java?rev=1633053&r1=1633052&r2=1633053&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java Mon Oct 20 06:10:08 2014
@@ -120,6 +120,8 @@ public class TopGroupsShardResponseProce
         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;