lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1399883 - /lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java
Date Thu, 18 Oct 2012 22:01:22 GMT
Author: mikemccand
Date: Thu Oct 18 22:01:22 2012
New Revision: 1399883

URL: http://svn.apache.org/viewvc?rev=1399883&view=rev
Log:
make test easier if it get SimpleText postings format

Modified:
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java?rev=1399883&r1=1399882&r2=1399883&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java Thu
Oct 18 22:01:22 2012
@@ -25,6 +25,9 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.CountDownLatch;
 
+import org.apache.lucene.codecs.Codec;
+import org.apache.lucene.codecs.PostingsFormat;
+import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.store.Directory;
@@ -43,10 +46,29 @@ public class TestBagOfPostings extends L
     List<String> postingsList = new ArrayList<String>();
     int numTerms = atLeast(300);
     final int maxTermsPerDoc = _TestUtil.nextInt(random(), 10, 20);
+
+    boolean isSimpleText = false;
+    Codec defaultCodec = Codec.getDefault();
+
+    if (defaultCodec.getName().equals("SimpleText")) {
+      isSimpleText = true;
+    } else {
+      PostingsFormat defaultPostingsFormat = defaultCodec.postingsFormat();
+      if (defaultPostingsFormat instanceof PerFieldPostingsFormat) {
+        isSimpleText = ((PerFieldPostingsFormat) defaultPostingsFormat).getPostingsFormatForField("field").getName().equals("SimpleText");
+      }
+    }
+
+    if (isSimpleText && TEST_NIGHTLY) {
+      // Otherwise test can take way too long (> 2 hours)
+      numTerms /= 2;
+    }
+
     if (VERBOSE) {
       System.out.println("maxTermsPerDoc=" + maxTermsPerDoc);
       System.out.println("numTerms=" + numTerms);
     }
+
     for (int i = 0; i < numTerms; i++) {
       String term = Integer.toString(i);
       for (int j = 0; j < i; j++) {



Mime
View raw message