lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1402471 - /lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/Test2BPostings.java
Date Fri, 26 Oct 2012 11:46:40 GMT
Author: mikemccand
Date: Fri Oct 26 11:46:39 2012
New Revision: 1402471

URL: http://svn.apache.org/viewvc?rev=1402471&view=rev
Log:
don't use MEMORY_DOC or MEMORY_CHUNK w/ CompressingStoredFields with this test

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

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/Test2BPostings.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/Test2BPostings.java?rev=1402471&r1=1402470&r2=1402471&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/Test2BPostings.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/Test2BPostings.java Fri
Oct 26 11:46:39 2012
@@ -20,6 +20,10 @@ package org.apache.lucene.index;
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
+import org.apache.lucene.codecs.compressing.CompressingCodec;
+import org.apache.lucene.codecs.compressing.CompressingStoredFieldsFormat;
+import org.apache.lucene.codecs.compressing.CompressingStoredFieldsIndex;
+import org.apache.lucene.codecs.compressing.CompressionMode;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.FieldType;
@@ -27,12 +31,13 @@ import org.apache.lucene.document.TextFi
 import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.store.BaseDirectoryWrapper;
 import org.apache.lucene.store.MockDirectoryWrapper;
+import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TimeUnits;
 import org.apache.lucene.util._TestUtil;
-import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
-
 import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;
+import com.carrotsearch.randomizedtesting.generators.RandomInts;
+import com.carrotsearch.randomizedtesting.generators.RandomPicks;
 
 /**
  * Test indexes ~82M docs with 26 terms each, so you get > Integer.MAX_VALUE terms/docs
pairs
@@ -48,14 +53,26 @@ public class Test2BPostings extends Luce
     if (dir instanceof MockDirectoryWrapper) {
       ((MockDirectoryWrapper)dir).setThrottling(MockDirectoryWrapper.Throttling.NEVER);
     }
-    
-    IndexWriter w = new IndexWriter(dir,
-        new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()))
+
+    IndexWriterConfig iwc = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()))
         .setMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH)
         .setRAMBufferSizeMB(256.0)
         .setMergeScheduler(new ConcurrentMergeScheduler())
         .setMergePolicy(newLogMergePolicy(false, 10))
-        .setOpenMode(IndexWriterConfig.OpenMode.CREATE));
+        .setOpenMode(IndexWriterConfig.OpenMode.CREATE);
+
+    if (iwc.getCodec() instanceof CompressingCodec) {
+      CompressingStoredFieldsFormat fmt = (CompressingStoredFieldsFormat) ((CompressingCodec)
iwc.getCodec()).storedFieldsFormat();
+      // NOTE: copied from CompressingCodec.randomInstance(), but fixed to not
+      // use any memory index ... maybe we can instead add
+      // something like CompressingMemory to the
+      // SuppressCodecs list...?:
+      final CompressionMode mode = RandomPicks.randomFrom(random(), CompressionMode.values());
+      final int chunkSize = RandomInts.randomIntBetween(random(), 1, 500);
+      iwc.setCodec(new CompressingCodec(mode, chunkSize, CompressingStoredFieldsIndex.DISK_DOC));
+    }
+    
+    IndexWriter w = new IndexWriter(dir, iwc);
 
     MergePolicy mp = w.getConfig().getMergePolicy();
     if (mp instanceof LogByteSizeMergePolicy) {



Mime
View raw message