You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/10/19 00:05:15 UTC
svn commit: r1399886 - in /lucene/dev/branches/branch_4x: ./ lucene/
lucene/core/
lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java
Author: mikemccand
Date: Thu Oct 18 22:05:14 2012
New Revision: 1399886
URL: http://svn.apache.org/viewvc?rev=1399886&view=rev
Log:
make test easier if it get SimpleText postings format
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java?rev=1399886&r1=1399885&r2=1399886&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java Thu Oct 18 22:05:14 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++) {