lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1457351 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/facet/ lucene/facet/src/test/org/apache/lucene/facet/search/TestDrillSideways.java
Date Sun, 17 Mar 2013 00:27:19 GMT
Author: mikemccand
Date: Sun Mar 17 00:27:19 2013
New Revision: 1457351

URL: http://svn.apache.org/r1457351
Log:
LUCENE-4840: fix test to either use DV or not ... don't mix (so that we catch any bugs in
SSDVFFs drill down

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/facet/   (props changed)
    lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestDrillSideways.java

Modified: lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestDrillSideways.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestDrillSideways.java?rev=1457351&r1=1457350&r2=1457351&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestDrillSideways.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestDrillSideways.java
Sun Mar 17 00:27:19 2013
@@ -435,6 +435,7 @@ public class TestDrillSideways extends F
     }
     String[][] dimValues = new String[numDims][];
     int valueCount = 2;
+
     for(int dim=0;dim<numDims;dim++) {
       Set<String> values = new HashSet<String>();
       while (values.size() < valueCount) {
@@ -502,6 +503,8 @@ public class TestDrillSideways extends F
     facetFields = new FacetFields(tw);
     SortedSetDocValuesFacetFields dvFacetFields = new SortedSetDocValuesFacetFields();
 
+    boolean doUseDV = canUseDV && random().nextBoolean();
+
     for(Doc rawDoc : docs) {
       Document doc = new Document();
       doc.add(newStringField("id", rawDoc.id, Field.Store.YES));
@@ -532,9 +535,10 @@ public class TestDrillSideways extends F
         }
       }
       if (!paths.isEmpty()) {
-        facetFields.addFields(doc, paths);
-        if (canUseDV) {
+        if (doUseDV) {
           dvFacetFields.addFields(doc, paths);
+        } else {
+          facetFields.addFields(doc, paths);
         }
       }
 
@@ -571,7 +575,7 @@ public class TestDrillSideways extends F
     w.close();
 
     final SortedSetDocValuesReaderState sortedSetDVState;
-    if (canUseDV) {
+    if (doUseDV) {
       sortedSetDVState = new SortedSetDocValuesReaderState(r);
     } else {
       sortedSetDVState = null;
@@ -599,9 +603,8 @@ public class TestDrillSideways extends F
       String contentToken = random().nextInt(30) == 17 ? null : randomContentToken(true);
       int numDrillDown = _TestUtil.nextInt(random(), 1, Math.min(4, numDims));
       String[][] drillDowns = new String[numDims][];
-      boolean useSortedSetDV = canUseDV && random().nextBoolean();
       if (VERBOSE) {
-        System.out.println("\nTEST: iter=" + iter + " baseQuery=" + contentToken + " numDrillDown="
+ numDrillDown + " useSortedSetDV=" + useSortedSetDV);
+        System.out.println("\nTEST: iter=" + iter + " baseQuery=" + contentToken + " numDrillDown="
+ numDrillDown + " useSortedSetDV=" + doUseDV);
       }
 
       int count = 0;
@@ -716,7 +719,7 @@ public class TestDrillSideways extends F
 
       Sort sort = new Sort(new SortField("id", SortField.Type.STRING));
       DrillSideways ds;
-      if (useSortedSetDV) {
+      if (doUseDV) {
         ds = new DrillSideways(s, null) {
             @Override
             protected FacetsAccumulator getDrillDownAccumulator(FacetSearchParams fsp) throws
IOException {
@@ -739,7 +742,7 @@ public class TestDrillSideways extends F
       for(ScoreDoc sd : hits.scoreDocs) {
         scores.put(s.doc(sd.doc).get("id"), sd.score);
       }
-      verifyEquals(dimValues, s, expected, actual, scores, -1, useSortedSetDV);
+      verifyEquals(dimValues, s, expected, actual, scores, -1, doUseDV);
 
       // Make sure topN works:
       int topN = _TestUtil.nextInt(random(), 1, 20);
@@ -750,7 +753,7 @@ public class TestDrillSideways extends F
       }
       fsp = new FacetSearchParams(requests);
       actual = ds.search(ddq, filter, null, numDocs, sort, true, true, fsp);
-      verifyEquals(dimValues, s, expected, actual, scores, topN, useSortedSetDV);
+      verifyEquals(dimValues, s, expected, actual, scores, topN, doUseDV);
 
       // Make sure drill down doesn't change score:
       TopDocs ddqHits = s.search(ddq, filter, numDocs);



Mime
View raw message