mirror of https://github.com/apache/lucene.git
LUCENE-3069: merge trunk changes over
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3069@1493493 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
commit
13df813541
|
@ -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<drillDownTerms[dim].length;i++) {
|
||||
if (termsEnum.seekExact(drillDownTerms[dim][i].bytes(), false)) {
|
||||
DocsEnum docsEnum = termsEnum.docs(null, null);
|
||||
|
@ -138,7 +138,7 @@ class DrillSidewaysQuery extends Query {
|
|||
}
|
||||
}
|
||||
|
||||
if (nullCount > 1) {
|
||||
if (nullCount > 1 || (nullCount == 1 && dims.length == 1)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<numDims;dim++) {
|
||||
docsEnums[dim] = dims[dim].docsEnums;
|
||||
sidewaysCollectors[dim] = dims[dim].sidewaysCollector;
|
||||
if (dims[dim].docsEnums != null) {
|
||||
for (DocsEnum de : dims[dim].docsEnums) {
|
||||
if (de != null) {
|
||||
drillDownCost += de.cost();
|
||||
}
|
||||
for (DocsEnum de : dims[dim].docsEnums) {
|
||||
if (de != null) {
|
||||
drillDownCost += de.cost();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,11 +28,15 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import org.apache.lucene.analysis.MockAnalyzer;
|
||||
import org.apache.lucene.codecs.Codec;
|
||||
import org.apache.lucene.codecs.DocValuesFormat;
|
||||
import org.apache.lucene.codecs.perfield.PerFieldDocValuesFormat;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.StringField;
|
||||
import org.apache.lucene.facet.FacetTestCase;
|
||||
import org.apache.lucene.facet.FacetTestUtils;
|
||||
import org.apache.lucene.facet.codecs.facet42.Facet42DocValuesFormat;
|
||||
import org.apache.lucene.facet.index.FacetFields;
|
||||
import org.apache.lucene.facet.params.FacetIndexingParams;
|
||||
import org.apache.lucene.facet.params.FacetSearchParams;
|
||||
|
@ -58,8 +62,8 @@ import org.apache.lucene.search.Query;
|
|||
import org.apache.lucene.search.ScoreDoc;
|
||||
import org.apache.lucene.search.Scorer;
|
||||
import org.apache.lucene.search.Sort;
|
||||
import org.apache.lucene.search.SortField;
|
||||
import org.apache.lucene.search.SortField.Type;
|
||||
import org.apache.lucene.search.SortField;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.apache.lucene.search.TopDocs;
|
||||
import org.apache.lucene.store.Directory;
|
||||
|
@ -429,6 +433,16 @@ public class TestDrillSideways extends FacetTestCase {
|
|||
|
||||
boolean canUseDV = defaultCodecSupportsSortedSet();
|
||||
|
||||
// TestRuleSetupAndRestoreClassEnv can sometimes
|
||||
// randomly pick the non-general Facet42DocValuesFormat:
|
||||
DocValuesFormat dvf = Codec.getDefault().docValuesFormat();
|
||||
if (dvf instanceof PerFieldDocValuesFormat) {
|
||||
dvf = ((PerFieldDocValuesFormat) dvf).getDocValuesFormatForField("$facets");
|
||||
}
|
||||
if (dvf instanceof Facet42DocValuesFormat) {
|
||||
canUseDV = false;
|
||||
}
|
||||
|
||||
while (aChance == 0.0) {
|
||||
aChance = random().nextDouble();
|
||||
}
|
||||
|
@ -1175,6 +1189,5 @@ public class TestDrillSideways extends FacetTestCase {
|
|||
|
||||
IOUtils.close(searcher.getIndexReader(), taxoReader, dir, taxoDir);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue