lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r921480 [4/8] - in /lucene/java/trunk: ./ contrib/analyzers/common/src/test/org/apache/lucene/analysis/query/ contrib/analyzers/common/src/test/org/apache/lucene/analysis/shingle/ contrib/ant/src/java/org/apache/lucene/ant/ contrib/benchmar...
Date Wed, 10 Mar 2010 17:53:51 GMT
Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReader.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReader.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReader.java Wed Mar 10 17:53:46
2010
@@ -34,14 +34,13 @@ import java.util.SortedSet;
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
 
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.FieldSelector;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.document.SetBasedFieldSelector;
 import org.apache.lucene.index.IndexReader.FieldOption;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.search.FieldCache;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.ScoreDoc;
@@ -78,8 +77,7 @@ public class TestIndexReader extends Luc
       commitUserData.put("foo", "fighters");
       
       // set up writer
-      IndexWriter writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
-      writer.setMaxBufferedDocs(2);
+      IndexWriter writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT).setMaxBufferedDocs(2));
       for(int i=0;i<27;i++)
         addDocumentWithFields(writer);
       writer.close();
@@ -100,8 +98,8 @@ public class TestIndexReader extends Luc
       assertTrue(c.equals(r.getIndexCommit()));
 
       // Change the index
-      writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT), false, IndexWriter.MaxFieldLength.LIMITED);
-      writer.setMaxBufferedDocs(2);
+      writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT)
+        .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(2));
       for(int i=0;i<7;i++)
         addDocumentWithFields(writer);
       writer.close();
@@ -111,7 +109,7 @@ public class TestIndexReader extends Luc
       assertFalse(r2.getIndexCommit().isOptimized());
       r3.close();
 
-      writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT), false, IndexWriter.MaxFieldLength.LIMITED);
+      writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.APPEND));
       writer.optimize();
       writer.close();
 
@@ -122,22 +120,21 @@ public class TestIndexReader extends Luc
       d.close();
     }
     
-    public void testIsCurrent() throws Exception
-    {
+    public void testIsCurrent() throws Exception {
       RAMDirectory d = new MockRAMDirectory();
-      IndexWriter writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
+      IndexWriter writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT));
       addDocumentWithFields(writer);
       writer.close();
       // set up reader:
       IndexReader reader = IndexReader.open(d, false);
       assertTrue(reader.isCurrent());
       // modify index by adding another document:
-      writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT), false, IndexWriter.MaxFieldLength.LIMITED);
+      writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.APPEND));
       addDocumentWithFields(writer);
       writer.close();
       assertFalse(reader.isCurrent());
       // re-create index:
-      writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.LIMITED);
+      writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.CREATE));
       addDocumentWithFields(writer);
       writer.close();
       assertFalse(reader.isCurrent());
@@ -149,11 +146,10 @@ public class TestIndexReader extends Luc
      * Tests the IndexReader.getFieldNames implementation
      * @throws Exception on error
      */
-    public void testGetFieldNames() throws Exception
-    {
+    public void testGetFieldNames() throws Exception {
         RAMDirectory d = new MockRAMDirectory();
         // set up writer
-        IndexWriter writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
+        IndexWriter writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT));
         addDocumentWithFields(writer);
         writer.close();
         // set up reader
@@ -165,20 +161,18 @@ public class TestIndexReader extends Luc
         assertTrue(fieldNames.contains("unstored"));
         reader.close();
         // add more documents
-        writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT), false, IndexWriter.MaxFieldLength.LIMITED);
+        writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.APPEND));
         // want to get some more segments here
-        for (int i = 0; i < 5*writer.getMergeFactor(); i++)
-        {
+        int mergeFactor = ((LogMergePolicy) writer.getMergePolicy()).getMergeFactor();
+        for (int i = 0; i < 5*mergeFactor; i++) {
             addDocumentWithFields(writer);
         }
         // new fields are in some different segments (we hope)
-        for (int i = 0; i < 5*writer.getMergeFactor(); i++)
-        {
+        for (int i = 0; i < 5*mergeFactor; i++) {
             addDocumentWithDifferentFields(writer);
         }
         // new termvector fields
-        for (int i = 0; i < 5*writer.getMergeFactor(); i++)
-        {
+        for (int i = 0; i < 5*mergeFactor; i++) {
           addDocumentWithTermVectorFields(writer);
         }
         
@@ -245,10 +239,11 @@ public class TestIndexReader extends Luc
   public void testTermVectors() throws Exception {
     RAMDirectory d = new MockRAMDirectory();
     // set up writer
-    IndexWriter writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
+    IndexWriter writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT));
     // want to get some more segments here
     // new termvector fields
-    for (int i = 0; i < 5 * writer.getMergeFactor(); i++) {
+    int mergeFactor = ((LogMergePolicy) writer.getMergePolicy()).getMergeFactor();
+    for (int i = 0; i < 5 * mergeFactor; i++) {
       Document doc = new Document();
         doc.add(new Field("tvnot","one two two three three three", Field.Store.YES, Field.Index.ANALYZED,
Field.TermVector.NO));
         doc.add(new Field("termvector","one two two three three three", Field.Store.YES,
Field.Index.ANALYZED, Field.TermVector.YES));
@@ -271,10 +266,6 @@ public class TestIndexReader extends Luc
       assertTrue("entry is null and it shouldn't be", entry != null);
       System.out.println("Entry: " + entry);
     }
-
-
-
-
     
   }
 
@@ -302,10 +293,7 @@ public class TestIndexReader extends Luc
 
     }
 
-
-
-    public void testBasicDelete() throws IOException
-    {
+    public void testBasicDelete() throws IOException {
         Directory dir = new MockRAMDirectory();
 
         IndexWriter writer = null;
@@ -313,9 +301,8 @@ public class TestIndexReader extends Luc
         Term searchTerm = new Term("content", "aaa");
 
         //  add 100 documents with term : aaa
-        writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
-        for (int i = 0; i < 100; i++)
-        {
+        writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
+        for (int i = 0; i < 100; i++) {
             addDoc(writer, searchTerm.text());
         }
         writer.close();
@@ -350,12 +337,11 @@ public class TestIndexReader extends Luc
         dir.close();
     }
     
-    public void testBinaryFields() throws IOException
-    {
+    public void testBinaryFields() throws IOException {
         Directory dir = new RAMDirectory();
         byte[] bin = new byte[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
         
-        IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.UNLIMITED);
+        IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
         
         for (int i = 0; i < 10; i++) {
           addDoc(writer, "document number " + (i + 1));
@@ -364,7 +350,7 @@ public class TestIndexReader extends Luc
           addDocumentWithTermVectorFields(writer);
         }
         writer.close();
-        writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), false,
IndexWriter.MaxFieldLength.LIMITED);
+        writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.APPEND));
         Document doc = new Document();
         doc.add(new Field("bin1", bin));
         doc.add(new Field("junk", "junk text", Field.Store.NO, Field.Index.ANALYZED));
@@ -401,7 +387,7 @@ public class TestIndexReader extends Luc
         // force optimize
 
 
-        writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), false,
IndexWriter.MaxFieldLength.LIMITED);
+        writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.APPEND));
         writer.optimize();
         writer.close();
         reader = IndexReader.open(dir, false);
@@ -421,8 +407,7 @@ public class TestIndexReader extends Luc
 
     // Make sure attempts to make changes after reader is
     // closed throws IOException:
-    public void testChangesAfterClose() throws IOException
-    {
+    public void testChangesAfterClose() throws IOException {
         Directory dir = new RAMDirectory();
 
         IndexWriter writer = null;
@@ -430,9 +415,8 @@ public class TestIndexReader extends Luc
         Term searchTerm = new Term("content", "aaa");
 
         //  add 11 documents with term : aaa
-        writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
-        for (int i = 0; i < 11; i++)
-        {
+        writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
+        for (int i = 0; i < 11; i++) {
             addDoc(writer, searchTerm.text());
         }
         writer.close();
@@ -466,8 +450,7 @@ public class TestIndexReader extends Luc
     }
 
     // Make sure we get lock obtain failed exception with 2 writers:
-    public void testLockObtainFailed() throws IOException
-    {
+    public void testLockObtainFailed() throws IOException {
         Directory dir = new RAMDirectory();
 
         IndexWriter writer = null;
@@ -475,9 +458,8 @@ public class TestIndexReader extends Luc
         Term searchTerm = new Term("content", "aaa");
 
         //  add 11 documents with term : aaa
-        writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
-        for (int i = 0; i < 11; i++)
-        {
+        writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
+        for (int i = 0; i < 11; i++) {
             addDoc(writer, searchTerm.text());
         }
 
@@ -521,7 +503,7 @@ public class TestIndexReader extends Luc
         Term searchTerm = new Term("content", "aaa");
 
         //  add 1 documents with term : aaa
-        writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
+        writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
         addDoc(writer, searchTerm.text());
         writer.close();
 
@@ -558,16 +540,16 @@ public class TestIndexReader extends Luc
 
     // Make sure you can set norms & commit, and there are
     // no extra norms files left:
-    public void testWritingNormsNoReader() throws IOException
-    {
+    public void testWritingNormsNoReader() throws IOException {
         Directory dir = new MockRAMDirectory();
         IndexWriter writer = null;
         IndexReader reader = null;
         Term searchTerm = new Term("content", "aaa");
 
         //  add 1 documents with term : aaa
-        writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
-        writer.setUseCompoundFile(false);
+        writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
+        ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(false);
+        ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(false);
         addDoc(writer, searchTerm.text());
         writer.close();
 
@@ -611,8 +593,7 @@ public class TestIndexReader extends Luc
         deleteReaderWriterConflict(true);
     }
 
-    private void deleteReaderWriterConflict(boolean optimize) throws IOException
-    {
+    private void deleteReaderWriterConflict(boolean optimize) throws IOException {
         //Directory dir = new RAMDirectory();
         Directory dir = getDirectory();
 
@@ -620,9 +601,8 @@ public class TestIndexReader extends Luc
         Term searchTerm2 = new Term("content", "bbb");
 
         //  add 100 documents with term : aaa
-        IndexWriter writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
-        for (int i = 0; i < 100; i++)
-        {
+        IndexWriter writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.CREATE));
+        for (int i = 0; i < 100; i++) {
             addDoc(writer, searchTerm.text());
         }
         writer.close();
@@ -636,9 +616,8 @@ public class TestIndexReader extends Luc
         assertTermDocsCount("first reader", reader, searchTerm2, 0);
 
         // add 100 documents with term : bbb
-        writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), false,
IndexWriter.MaxFieldLength.LIMITED);
-        for (int i = 0; i < 100; i++)
-        {
+        writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.APPEND));
+        for (int i = 0; i < 100; i++) {
             addDoc(writer, searchTerm2.text());
         }
 
@@ -698,12 +677,11 @@ public class TestIndexReader extends Luc
     return FSDirectory.open(new File(System.getProperty("tempDir"), "testIndex"));
   }
 
-  public void testFilesOpenClose() throws IOException
-    {
+  public void testFilesOpenClose() throws IOException {
         // Create initial data set
         File dirFile = new File(System.getProperty("tempDir"), "testIndex");
         Directory dir = getDirectory();
-        IndexWriter writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
+        IndexWriter writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
         addDoc(writer, "test");
         writer.close();
         dir.close();
@@ -713,7 +691,7 @@ public class TestIndexReader extends Luc
         dir = getDirectory();
 
         // Now create the data set again, just as before
-        writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
+        writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.CREATE));
         addDoc(writer, "test");
         writer.close();
         dir.close();
@@ -739,7 +717,7 @@ public class TestIndexReader extends Luc
           else
             dir = getDirectory();
           assertFalse(IndexReader.indexExists(dir));
-          IndexWriter writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
+          IndexWriter writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.CREATE));
           addDocumentWithFields(writer);
           assertTrue(IndexWriter.isLocked(dir));		// writer open, so dir is locked
           writer.close();
@@ -756,7 +734,7 @@ public class TestIndexReader extends Luc
           // incremented:
           Thread.sleep(1000);
 
-          writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
+          writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.CREATE));
           addDocumentWithFields(writer);
           writer.close();
           reader = IndexReader.open(dir, false);
@@ -773,7 +751,7 @@ public class TestIndexReader extends Luc
     public void testVersion() throws IOException {
       Directory dir = new MockRAMDirectory();
       assertFalse(IndexReader.indexExists(dir));
-      IndexWriter writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
+      IndexWriter writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
       addDocumentWithFields(writer);
       assertTrue(IndexWriter.isLocked(dir));		// writer open, so dir is locked
       writer.close();
@@ -784,7 +762,7 @@ public class TestIndexReader extends Luc
       reader.close();
       // modify index and check version has been
       // incremented:
-      writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
IndexWriter.MaxFieldLength.LIMITED);
+      writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.CREATE));
       addDocumentWithFields(writer);
       writer.close();
       reader = IndexReader.open(dir, false);
@@ -795,10 +773,10 @@ public class TestIndexReader extends Luc
 
     public void testLock() throws IOException {
       Directory dir = new MockRAMDirectory();
-      IndexWriter writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
+      IndexWriter writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
       addDocumentWithFields(writer);
       writer.close();
-      writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), false,
IndexWriter.MaxFieldLength.LIMITED);
+      writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.APPEND));
       IndexReader reader = IndexReader.open(dir, false);
       try {
         reader.deleteDocument(0);
@@ -815,7 +793,7 @@ public class TestIndexReader extends Luc
 
     public void testUndeleteAll() throws IOException {
       Directory dir = new MockRAMDirectory();
-      IndexWriter writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
+      IndexWriter writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
       addDocumentWithFields(writer);
       addDocumentWithFields(writer);
       writer.close();
@@ -832,7 +810,7 @@ public class TestIndexReader extends Luc
 
     public void testUndeleteAllAfterClose() throws IOException {
       Directory dir = new MockRAMDirectory();
-      IndexWriter writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
+      IndexWriter writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
       addDocumentWithFields(writer);
       addDocumentWithFields(writer);
       writer.close();
@@ -849,7 +827,7 @@ public class TestIndexReader extends Luc
 
     public void testUndeleteAllAfterCloseThenReopen() throws IOException {
       Directory dir = new MockRAMDirectory();
-      IndexWriter writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
+      IndexWriter writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
       addDocumentWithFields(writer);
       addDocumentWithFields(writer);
       writer.close();
@@ -887,7 +865,7 @@ public class TestIndexReader extends Luc
       
       // First build up a starting index:
       RAMDirectory startDir = new MockRAMDirectory();
-      IndexWriter writer = new IndexWriter(startDir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
+      IndexWriter writer = new IndexWriter(startDir, new IndexWriterConfig(TEST_VERSION_CURRENT));
       for(int i=0;i<157;i++) {
         Document d = new Document();
         d.add(new Field("id", Integer.toString(i), Field.Store.YES, Field.Index.NOT_ANALYZED));
@@ -1077,7 +1055,7 @@ public class TestIndexReader extends Luc
 
     public void testDocsOutOfOrderJIRA140() throws IOException {
       Directory dir = new MockRAMDirectory();      
-      IndexWriter writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
+      IndexWriter writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
       for(int i=0;i<11;i++) {
         addDoc(writer, "aaa");
       }
@@ -1095,7 +1073,7 @@ public class TestIndexReader extends Luc
       }
       reader.close();
 
-      writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), false,
IndexWriter.MaxFieldLength.LIMITED);
+      writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.APPEND));
 
       // We must add more docs to get a new segment written
       for(int i=0;i<11;i++) {
@@ -1117,7 +1095,7 @@ public class TestIndexReader extends Luc
     public void testExceptionReleaseWriteLockJIRA768() throws IOException {
 
       Directory dir = new MockRAMDirectory();      
-      IndexWriter writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
+      IndexWriter writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
       addDoc(writer, "aaa");
       writer.close();
 
@@ -1182,8 +1160,7 @@ public class TestIndexReader extends Luc
       dir.close();
     }
 
-    private void deleteReaderReaderConflict(boolean optimize) throws IOException
-    {
+    private void deleteReaderReaderConflict(boolean optimize) throws IOException {
         Directory dir = getDirectory();
 
         Term searchTerm1 = new Term("content", "aaa");
@@ -1193,9 +1170,8 @@ public class TestIndexReader extends Luc
         //  add 100 documents with term : aaa
         //  add 100 documents with term : bbb
         //  add 100 documents with term : ccc
-        IndexWriter writer  = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
-        for (int i = 0; i < 100; i++)
-        {
+        IndexWriter writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.CREATE));
+        for (int i = 0; i < 100; i++) {
             addDoc(writer, searchTerm1.text());
             addDoc(writer, searchTerm2.text());
             addDoc(writer, searchTerm3.text());
@@ -1417,8 +1393,7 @@ public class TestIndexReader extends Luc
       RAMDirectory d = new MockRAMDirectory();
 
       // set up writer
-      IndexWriter writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
-      writer.setMaxBufferedDocs(2);
+      IndexWriter writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT).setMaxBufferedDocs(2));
       for(int i=0;i<27;i++)
         addDocumentWithFields(writer);
       writer.close();
@@ -1433,8 +1408,8 @@ public class TestIndexReader extends Luc
       assertTrue(c.equals(r.getIndexCommit()));
 
       // Change the index
-      writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT), false, IndexWriter.MaxFieldLength.LIMITED);
-      writer.setMaxBufferedDocs(2);
+      writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT)
+        .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(2));
       for(int i=0;i<7;i++)
         addDocumentWithFields(writer);
       writer.close();
@@ -1444,7 +1419,7 @@ public class TestIndexReader extends Luc
       assertFalse(r2.getIndexCommit().isOptimized());
       r2.close();
 
-      writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT), false, IndexWriter.MaxFieldLength.LIMITED);
+      writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.APPEND));
       writer.optimize();
       writer.close();
 
@@ -1458,7 +1433,7 @@ public class TestIndexReader extends Luc
 
     public void testReadOnly() throws Throwable {
       RAMDirectory d = new MockRAMDirectory();
-      IndexWriter writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT),
true, IndexWriter.MaxFieldLength.LIMITED);
+      IndexWriter writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT));
       addDocumentWithFields(writer);
       writer.commit();
       addDocumentWithFields(writer);
@@ -1472,7 +1447,7 @@ public class TestIndexReader extends Luc
         // expected
       }
       
-      writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT), false, IndexWriter.MaxFieldLength.LIMITED);
+      writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.APPEND));
       addDocumentWithFields(writer);
       writer.close();
 
@@ -1489,7 +1464,7 @@ public class TestIndexReader extends Luc
         // expected
       }
 
-      writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT), false, IndexWriter.MaxFieldLength.LIMITED);
+      writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.APPEND));
       writer.optimize();
       writer.close();
 
@@ -1507,7 +1482,7 @@ public class TestIndexReader extends Luc
       }
 
       // Make sure write lock isn't held
-      writer = new IndexWriter(d, new StandardAnalyzer(TEST_VERSION_CURRENT), false, IndexWriter.MaxFieldLength.LIMITED);
+      writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT).setOpenMode(OpenMode.APPEND));
       writer.close();
 
       r3.close();
@@ -1517,8 +1492,7 @@ public class TestIndexReader extends Luc
   // LUCENE-1474
   public void testIndexReader() throws Exception {
     Directory dir = new RAMDirectory();
-    IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(TEST_VERSION_CURRENT),
-                                         IndexWriter.MaxFieldLength.UNLIMITED);
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
     writer.addDocument(createDocument("a"));
     writer.addDocument(createDocument("b"));
     writer.addDocument(createDocument("c"));
@@ -1535,8 +1509,7 @@ public class TestIndexReader extends Luc
   public void testIndexReaderUnDeleteAll() throws Exception {
     MockRAMDirectory dir = new MockRAMDirectory();
     dir.setPreventDoubleWrite(false);
-    IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(TEST_VERSION_CURRENT),
-                                         IndexWriter.MaxFieldLength.UNLIMITED);
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
     writer.addDocument(createDocument("a"));
     writer.addDocument(createDocument("b"));
     writer.addDocument(createDocument("c"));
@@ -1577,10 +1550,7 @@ public class TestIndexReader extends Luc
 
     Directory dir = new MockRAMDirectory();
     
-    IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(TEST_VERSION_CURRENT),
-                                         IndexWriter.MaxFieldLength.LIMITED);
-
-    writer.setMaxBufferedDocs(2);
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT).setMaxBufferedDocs(2));
     writer.addDocument(createDocument("a"));
     writer.addDocument(createDocument("a"));
     writer.addDocument(createDocument("a"));
@@ -1603,7 +1573,7 @@ public class TestIndexReader extends Luc
   // reuse the doc values arrays in FieldCache
   public void testFieldCacheReuseAfterClone() throws Exception {
     Directory dir = new MockRAMDirectory();
-    IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
IndexWriter.MaxFieldLength.UNLIMITED);
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
     Document doc = new Document();
     doc.add(new Field("number", "17", Field.Store.NO, Field.Index.NOT_ANALYZED));
     writer.addDocument(doc);
@@ -1634,7 +1604,7 @@ public class TestIndexReader extends Luc
   // FieldCache
   public void testFieldCacheReuseAfterReopen() throws Exception {
     Directory dir = new MockRAMDirectory();
-    IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
IndexWriter.MaxFieldLength.UNLIMITED);
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
     Document doc = new Document();
     doc.add(new Field("number", "17", Field.Store.NO, Field.Index.NOT_ANALYZED));
     writer.addDocument(doc);
@@ -1666,7 +1636,7 @@ public class TestIndexReader extends Luc
   // reopen switches readOnly
   public void testReopenChangeReadonly() throws Exception {
     Directory dir = new MockRAMDirectory();
-    IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
IndexWriter.MaxFieldLength.UNLIMITED);
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
     Document doc = new Document();
     doc.add(new Field("number", "17", Field.Store.NO, Field.Index.NOT_ANALYZED));
     writer.addDocument(doc);
@@ -1707,7 +1677,7 @@ public class TestIndexReader extends Luc
   // LUCENE-1586: getUniqueTermCount
   public void testUniqueTermCount() throws Exception {
     Directory dir = new MockRAMDirectory();
-    IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
IndexWriter.MaxFieldLength.UNLIMITED);
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
     Document doc = new Document();
     doc.add(new Field("field", "a b c d e f g h i j k l m n o p q r s t u v w x y z", Field.Store.NO,
Field.Index.ANALYZED));
     doc.add(new Field("number", "0 1 2 3 4 5 6 7 8 9", Field.Store.NO, Field.Index.ANALYZED));
@@ -1740,7 +1710,7 @@ public class TestIndexReader extends Luc
   // LUCENE-1609: don't load terms index
   public void testNoTermsIndex() throws Throwable {
     Directory dir = new MockRAMDirectory();
-    IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
IndexWriter.MaxFieldLength.UNLIMITED);
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
     Document doc = new Document();
     doc.add(new Field("field", "a b c d e f g h i j k l m n o p q r s t u v w x y z", Field.Store.NO,
Field.Index.ANALYZED));
     doc.add(new Field("number", "0 1 2 3 4 5 6 7 8 9", Field.Store.NO, Field.Index.ANALYZED));
@@ -1758,7 +1728,7 @@ public class TestIndexReader extends Luc
     assertFalse(((SegmentReader) r.getSequentialSubReaders()[0]).termsIndexLoaded());
 
     assertEquals(-1, ((SegmentReader) r.getSequentialSubReaders()[0]).getTermInfosIndexDivisor());
-    writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), IndexWriter.MaxFieldLength.UNLIMITED);
+    writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
     writer.addDocument(doc);
     writer.close();
 
@@ -1777,7 +1747,7 @@ public class TestIndexReader extends Luc
   // LUCENE-2046
   public void testPrepareCommitIsCurrent() throws Throwable {
     Directory dir = new MockRAMDirectory();
-    IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
IndexWriter.MaxFieldLength.UNLIMITED);
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
     Document doc = new Document();
     writer.addDocument(doc);
     IndexReader r = IndexReader.open(dir, true);

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderClone.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderClone.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderClone.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderClone.java Wed Mar 10
17:53:46 2010
@@ -19,7 +19,6 @@ package org.apache.lucene.index;
 
 import org.apache.lucene.index.SegmentReader.Norm;
 import org.apache.lucene.search.Similarity;
-import org.apache.lucene.analysis.SimpleAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.store.Directory;
@@ -197,7 +196,7 @@ public class TestIndexReaderClone extend
 
     TestIndexReaderReopen.createIndex(dir1, true);
     IndexReader reader1 = IndexReader.open(dir1, false);
-    IndexWriter w = new IndexWriter(dir1, new SimpleAnalyzer(TEST_VERSION_CURRENT), IndexWriter.MaxFieldLength.LIMITED);
+    IndexWriter w = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT));
     w.optimize();
     w.close();
     IndexReader reader2 = reader1.clone(true);
@@ -484,8 +483,9 @@ public class TestIndexReaderClone extend
 
   public void testCloseStoredFields() throws Exception {
     final Directory dir = new MockRAMDirectory();
-    IndexWriter w = new IndexWriter(dir, new SimpleAnalyzer(TEST_VERSION_CURRENT), IndexWriter.MaxFieldLength.UNLIMITED);
-    w.setUseCompoundFile(false);
+    IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
+    ((LogMergePolicy) w.getMergePolicy()).setUseCompoundFile(false);
+    ((LogMergePolicy) w.getMergePolicy()).setUseCompoundDocStore(false);
     Document doc = new Document();
     doc.add(new Field("field", "yes it's stored", Field.Store.YES, Field.Index.ANALYZED));
     w.addDocument(doc);

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java Wed
Mar 10 17:53:46 2010
@@ -28,6 +28,7 @@ import org.apache.lucene.document.Docume
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Field.Index;
 import org.apache.lucene.document.Field.Store;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.index.SegmentReader.Norm;
 import org.apache.lucene.search.DefaultSimilarity;
 import org.apache.lucene.search.Similarity;
@@ -118,10 +119,10 @@ public class TestIndexReaderCloneNorms e
     Directory dir3 = FSDirectory.open(indexDir3);
 
     createIndex(dir3);
-    IndexWriter iw = new IndexWriter(dir3, anlzr, false,
-        IndexWriter.MaxFieldLength.LIMITED);
-    iw.setMaxBufferedDocs(5);
-    iw.setMergeFactor(3);
+    IndexWriter iw = new IndexWriter(dir3, new IndexWriterConfig(
+        TEST_VERSION_CURRENT).setAnalyzer(anlzr).setOpenMode(OpenMode.APPEND)
+        .setMaxBufferedDocs(5));
+    ((LogMergePolicy) iw.getMergePolicy()).setMergeFactor(3);
     iw.addIndexesNoOptimize(new Directory[] { dir1, dir2 });
     iw.optimize();
     iw.close();
@@ -137,9 +138,9 @@ public class TestIndexReaderCloneNorms e
     doTestNorms(dir3);
 
     // now with optimize
-    iw = new IndexWriter(dir3, anlzr, false, IndexWriter.MaxFieldLength.LIMITED);
-    iw.setMaxBufferedDocs(5);
-    iw.setMergeFactor(3);
+    iw = new IndexWriter(dir3, new IndexWriterConfig(TEST_VERSION_CURRENT)
+        .setAnalyzer(anlzr).setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(5));
+    ((LogMergePolicy) iw.getMergePolicy()).setMergeFactor(3);
     iw.optimize();
     iw.close();
     verifyIndex(dir3);
@@ -238,12 +239,13 @@ public class TestIndexReaderCloneNorms e
   }
   
   private void createIndex(Directory dir) throws IOException {
-    IndexWriter iw = new IndexWriter(dir, anlzr, true,
-        IndexWriter.MaxFieldLength.LIMITED);
-    iw.setMaxBufferedDocs(5);
-    iw.setMergeFactor(3);
-    iw.setSimilarity(similarityOne);
-    iw.setUseCompoundFile(true);
+    IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(
+        TEST_VERSION_CURRENT).setAnalyzer(anlzr).setOpenMode(OpenMode.CREATE)
+        .setMaxBufferedDocs(5).setSimilarity(similarityOne));
+    LogMergePolicy lmp = (LogMergePolicy) iw.getMergePolicy();
+    lmp.setMergeFactor(3);
+    lmp.setUseCompoundFile(true);
+    lmp.setUseCompoundDocStore(true);
     iw.close();
   }
 
@@ -290,12 +292,13 @@ public class TestIndexReaderCloneNorms e
 
   private void addDocs(Directory dir, int ndocs, boolean compound)
       throws IOException {
-    IndexWriter iw = new IndexWriter(dir, anlzr, false,
-        IndexWriter.MaxFieldLength.LIMITED);
-    iw.setMaxBufferedDocs(5);
-    iw.setMergeFactor(3);
-    iw.setSimilarity(similarityOne);
-    iw.setUseCompoundFile(compound);
+    IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(
+        TEST_VERSION_CURRENT).setAnalyzer(anlzr).setOpenMode(OpenMode.APPEND)
+        .setMaxBufferedDocs(5).setSimilarity(similarityOne));
+    LogMergePolicy lmp = (LogMergePolicy) iw.getMergePolicy();
+    lmp.setMergeFactor(3);
+    lmp.setUseCompoundFile(compound);
+    lmp.setUseCompoundDocStore(compound);
     for (int i = 0; i < ndocs; i++) {
       iw.addDocument(newDoc());
     }

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexReaderReopen.java Wed Mar
10 17:53:46 2010
@@ -31,13 +31,11 @@ import java.util.HashMap;
 import java.util.Set;
 
 import org.apache.lucene.analysis.KeywordAnalyzer;
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Field.Index;
 import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.index.IndexWriter.MaxFieldLength;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TermQuery;
@@ -171,8 +169,9 @@ public class TestIndexReaderReopen exten
   }
 
   private void doTestReopenWithCommit (Directory dir, boolean withReopen) throws IOException
{
-    IndexWriter iwriter = new IndexWriter(dir, new KeywordAnalyzer(), true, MaxFieldLength.LIMITED);
-    iwriter.setMergeScheduler(new SerialMergeScheduler());
+    IndexWriter iwriter = new IndexWriter(dir, new IndexWriterConfig(
+        TEST_VERSION_CURRENT).setOpenMode(OpenMode.CREATE).setAnalyzer(
+        new KeywordAnalyzer()).setMergeScheduler(new SerialMergeScheduler()));
     IndexReader reader = IndexReader.open(dir, false);
     try {
       int M = 3;
@@ -702,7 +701,7 @@ public class TestIndexReaderReopen exten
     final Directory dir = new MockRAMDirectory();
     final int n = 30;
 
-    IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(TEST_VERSION_CURRENT),
IndexWriter.MaxFieldLength.LIMITED);
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
     for (int i = 0; i < n; i++) {
       writer.addDocument(createDocument(i, 3));
     }
@@ -721,7 +720,7 @@ public class TestIndexReaderReopen exten
           modifier.deleteDocument(i % modifier.maxDoc());
           modifier.close();
         } else {
-          IndexWriter modifier = new IndexWriter(dir, new StandardAnalyzer(TEST_VERSION_CURRENT),
IndexWriter.MaxFieldLength.LIMITED);
+          IndexWriter modifier = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
           modifier.addDocument(createDocument(n + i, 6));
           modifier.close();
         }
@@ -946,7 +945,7 @@ public class TestIndexReaderReopen exten
   
   public static void createIndex(Directory dir, boolean multiSegment) throws IOException
{
     IndexWriter.unlock(dir);
-    IndexWriter w = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), IndexWriter.MaxFieldLength.LIMITED);
+    IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
 
     w.setMergePolicy(new LogDocMergePolicy(w));
     
@@ -991,7 +990,7 @@ public class TestIndexReaderReopen exten
   static void modifyIndex(int i, Directory dir) throws IOException {
     switch (i) {
       case 0: {
-        IndexWriter w = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
IndexWriter.MaxFieldLength.LIMITED);
+        IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
         w.deleteDocuments(new Term("field2", "a11"));
         w.deleteDocuments(new Term("field2", "b30"));
         w.close();
@@ -1006,13 +1005,13 @@ public class TestIndexReaderReopen exten
         break;
       }
       case 2: {
-        IndexWriter w = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
IndexWriter.MaxFieldLength.LIMITED);
+        IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
         w.optimize();
         w.close();
         break;
       }
       case 3: {
-        IndexWriter w = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
IndexWriter.MaxFieldLength.LIMITED);
+        IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
         w.addDocument(createDocument(101, 4));
         w.optimize();
         w.addDocument(createDocument(102, 4));
@@ -1028,7 +1027,7 @@ public class TestIndexReaderReopen exten
         break;
       }
       case 5: {
-        IndexWriter w = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
IndexWriter.MaxFieldLength.LIMITED);
+        IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT));
         w.addDocument(createDocument(101, 4));
         w.close();
         break;
@@ -1192,7 +1191,8 @@ public class TestIndexReaderReopen exten
 
   public void testReopenOnCommit() throws Throwable {
     Directory dir = new MockRAMDirectory();
-    IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT),
new KeepAllCommits(), IndexWriter.MaxFieldLength.UNLIMITED);
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+        TEST_VERSION_CURRENT).setIndexDeletionPolicy(new KeepAllCommits()));
     for(int i=0;i<4;i++) {
       Document doc = new Document();
       doc.add(new Field("id", ""+i, Field.Store.NO, Field.Index.NOT_ANALYZED));



Mime
View raw message