diff --git a/src/java/org/apache/solr/handler/component/DebugComponent.java b/src/java/org/apache/solr/handler/component/DebugComponent.java index 5cd396a49e8..2fe19d52157 100644 --- a/src/java/org/apache/solr/handler/component/DebugComponent.java +++ b/src/java/org/apache/solr/handler/component/DebugComponent.java @@ -87,7 +87,7 @@ public class DebugComponent extends SearchComponent public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq) { if (!rb.isDebug()) return; - // Turn on debug to get explain only only when retrieving fields + // Turn on debug to get explain only when retrieving fields if ((sreq.purpose & ShardRequest.PURPOSE_GET_FIELDS) != 0) { sreq.purpose |= ShardRequest.PURPOSE_GET_DEBUG; sreq.params.set("debugQuery", "true"); @@ -130,6 +130,10 @@ public class DebugComponent extends SearchComponent } explain = HighlightComponent.removeNulls(new SimpleOrderedMap(Arrays.asList(arr))); + + if (info == null) { + info = new NamedList(); + } int idx = info.indexOf("explain",0); if (idx>=0) { info.setVal(idx, explain); diff --git a/src/test/org/apache/solr/TestDistributedSearch.java b/src/test/org/apache/solr/TestDistributedSearch.java index cf4099741e6..2301cf23f86 100755 --- a/src/test/org/apache/solr/TestDistributedSearch.java +++ b/src/test/org/apache/solr/TestDistributedSearch.java @@ -486,6 +486,9 @@ public class TestDistributedSearch extends TestCase { query("q","now their fox sat had put","fl","*,score", "debugQuery", "true"); + query("q","matchesnothing","fl","*,score", + "debugQuery", "true"); + query("q","*:*", "rows",100, "facet","true", "facet.field",t1); query("q","*:*", "rows",100, "facet","true", "facet.field",t1,"facet.limit",1); query("q","*:*", "rows",100, "facet","true", "facet.query","quick", "facet.query","all", "facet.query","*:*");