diff --git a/lucene/facet/src/java/org/apache/lucene/facet/search/DrillSidewaysQuery.java b/lucene/facet/src/java/org/apache/lucene/facet/search/DrillSidewaysQuery.java index afa0906808c..cbc74a22f35 100644 --- a/lucene/facet/src/java/org/apache/lucene/facet/search/DrillSidewaysQuery.java +++ b/lucene/facet/src/java/org/apache/lucene/facet/search/DrillSidewaysQuery.java @@ -122,11 +122,11 @@ class DrillSidewaysQuery extends Query { } lastField = field; } + dims[dim].docsEnums = new DocsEnum[drillDownTerms[dim].length]; if (termsEnum == null) { nullCount++; continue; } - dims[dim].docsEnums = new DocsEnum[drillDownTerms[dim].length]; for(int i=0;i 1) { + if (nullCount > 1 || (nullCount == 1 && dims.length == 1)) { return null; } diff --git a/lucene/facet/src/java/org/apache/lucene/facet/search/DrillSidewaysScorer.java b/lucene/facet/src/java/org/apache/lucene/facet/search/DrillSidewaysScorer.java index c3f2eecd2ed..42f53905935 100644 --- a/lucene/facet/src/java/org/apache/lucene/facet/search/DrillSidewaysScorer.java +++ b/lucene/facet/src/java/org/apache/lucene/facet/search/DrillSidewaysScorer.java @@ -80,11 +80,9 @@ class DrillSidewaysScorer extends Scorer { // Position all scorers to their first matching doc: baseScorer.nextDoc(); for(DocsEnumsAndFreq dim : dims) { - if (dim.docsEnums != null) { - for (DocsEnum docsEnum : dim.docsEnums) { - if (docsEnum != null) { - docsEnum.nextDoc(); - } + for (DocsEnum docsEnum : dim.docsEnums) { + if (docsEnum != null) { + docsEnum.nextDoc(); } } } @@ -97,11 +95,9 @@ class DrillSidewaysScorer extends Scorer { for(int dim=0;dim