fix test failure

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1493391 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2013-06-15 16:21:35 +00:00
parent a415009d08
commit c362eeb2af
1 changed files with 15 additions and 1 deletions

View File

@ -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();
}