lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r926725 [2/3] - in /lucene/java/branches/flex_1458: ./ backwards/src/ backwards/src/java/org/apache/lucene/index/ backwards/src/java/org/apache/lucene/search/ backwards/src/test/org/apache/lucene/analysis/ backwards/src/test/org/apache/luce...
Date Tue, 23 Mar 2010 18:52:21 GMT
Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java Tue Mar 23 18:52:19 2010
@@ -51,8 +51,8 @@ public class TestAddIndexesNoOptimize ex
     _TestUtil.checkIndex(dir);
 
     writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE));
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(false); // use one without a compound file
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false); // use one without a compound file
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file
     // add 40 documents in separate files
     addDocs(writer, 40);
     assertEquals(40, writer.maxDoc());
@@ -261,14 +261,14 @@ public class TestAddIndexesNoOptimize ex
     writer.close();
 
     writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(1000));
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(false); // use one without a compound file
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false); // use one without a compound file
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file
     // add 140 documents in separate files
     addDocs(writer, 40);
     writer.close();
     writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(1000));
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(false); // use one without a compound file
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false); // use one without a compound file
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file
     addDocs(writer, 100);
     writer.close();
 
@@ -301,7 +301,7 @@ public class TestAddIndexesNoOptimize ex
     IndexWriter writer = newWriter(dir, new IndexWriterConfig(
         TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
         .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(10));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(4);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4);
     addDocs(writer, 10);
 
     writer.addIndexesNoOptimize(new Directory[] { aux });
@@ -324,7 +324,7 @@ public class TestAddIndexesNoOptimize ex
     setUpDirs(dir, aux);
 
     IndexWriter writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(9));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(4);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4);
     addDocs(writer, 2);
 
     writer.addIndexesNoOptimize(new Directory[] { aux });
@@ -349,7 +349,7 @@ public class TestAddIndexesNoOptimize ex
     IndexWriter writer = newWriter(dir, new IndexWriterConfig(
         TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
         .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(10));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(4);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4);
 
     writer.addIndexesNoOptimize(new Directory[] { aux, new RAMDirectory(aux) });
     assertEquals(1060, writer.maxDoc());
@@ -379,7 +379,7 @@ public class TestAddIndexesNoOptimize ex
     IndexWriter writer = newWriter(dir, new IndexWriterConfig(
         TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
         .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(4));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(4);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4);
 
     writer.addIndexesNoOptimize(new Directory[] { aux, new RAMDirectory(aux) });
     assertEquals(1020, writer.maxDoc());
@@ -403,7 +403,7 @@ public class TestAddIndexesNoOptimize ex
     IndexWriter writer = newWriter(aux2, new IndexWriterConfig(
         TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
         .setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(100));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(10);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(10);
     writer.addIndexesNoOptimize(new Directory[] { aux });
     assertEquals(30, writer.maxDoc());
     assertEquals(3, writer.getSegmentCount());
@@ -425,7 +425,7 @@ public class TestAddIndexesNoOptimize ex
 
     writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
         .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(6));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(4);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4);
 
     writer.addIndexesNoOptimize(new Directory[] { aux, aux2 });
     assertEquals(1025, writer.maxDoc());
@@ -438,8 +438,8 @@ public class TestAddIndexesNoOptimize ex
 
   private IndexWriter newWriter(Directory dir, IndexWriterConfig conf)
       throws IOException {
+    conf.setMergePolicy(new LogDocMergePolicy());
     final IndexWriter writer = new IndexWriter(dir, conf);
-    writer.setMergePolicy(new LogDocMergePolicy(writer));
     return writer;
   }
 
@@ -490,17 +490,17 @@ public class TestAddIndexesNoOptimize ex
     writer.close();
 
     writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(100));
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(false); // use one without a compound file
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(10);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false); // use one without a compound file
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(10);
     // add 30 documents in 3 segments
     for (int i = 0; i < 3; i++) {
       addDocs(writer, 10);
       writer.close();
       writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(100));
-      ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(false); // use one without a compound file
-      ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file
-      ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(10);
+      ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false); // use one without a compound file
+      ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file
+      ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(10);
     }
     assertEquals(30, writer.maxDoc());
     assertEquals(3, writer.getSegmentCount());
@@ -511,12 +511,13 @@ public class TestAddIndexesNoOptimize ex
   public void testHangOnClose() throws IOException {
 
     Directory dir = new MockRAMDirectory();
-    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(5));
-    LogByteSizeMergePolicy lmp = new LogByteSizeMergePolicy(writer);
+    LogByteSizeMergePolicy lmp = new LogByteSizeMergePolicy();
     lmp.setUseCompoundFile(false);
     lmp.setUseCompoundDocStore(false);
     lmp.setMergeFactor(100);
-    writer.setMergePolicy(lmp);
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+        .setMaxBufferedDocs(5).setMergePolicy(lmp));
 
     Document doc = new Document();
     doc.add(new Field("content", "aaa bbb ccc ddd eee fff ggg hhh iii", Field.Store.YES,
@@ -538,13 +539,14 @@ public class TestAddIndexesNoOptimize ex
     writer.close();
 
     Directory dir2 = new MockRAMDirectory();
-    writer = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMergeScheduler(new SerialMergeScheduler()));
-    lmp = new LogByteSizeMergePolicy(writer);
+    lmp = new LogByteSizeMergePolicy();
     lmp.setMinMergeMB(0.0001);
     lmp.setUseCompoundFile(false);
     lmp.setUseCompoundDocStore(false);
     lmp.setMergeFactor(4);
-    writer.setMergePolicy(lmp);
+    writer = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT,
+        new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+        .setMergeScheduler(new SerialMergeScheduler()).setMergePolicy(lmp));
     writer.addIndexesNoOptimize(new Directory[] {dir});
     writer.close();
     dir.close();
@@ -556,15 +558,15 @@ public class TestAddIndexesNoOptimize ex
   public void testTargetCFS() throws IOException {
     Directory dir = new RAMDirectory();
     IndexWriter writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)));
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(false);
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(false);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false);
     addDocs(writer, 1);
     writer.close();
 
     Directory other = new RAMDirectory();
     writer = newWriter(other, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)));
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(true);
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(true);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(true);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(true);
     writer.addIndexesNoOptimize(new Directory[] {dir});
     assertTrue(writer.newestSegment().getUseCompoundFile());
     writer.close();

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestAtomicUpdate.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestAtomicUpdate.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestAtomicUpdate.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestAtomicUpdate.java Tue Mar 23 18:52:19 2010
@@ -126,10 +126,11 @@ public class TestAtomicUpdate extends Lu
 
     TimedThread[] threads = new TimedThread[4];
 
-    IndexWriter writer = new MockIndexWriter(directory, new IndexWriterConfig(
+    IndexWriterConfig conf = new IndexWriterConfig(
         TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT))
-        .setMaxBufferedDocs(4));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(2);
+        .setMaxBufferedDocs(7);
+    ((LogMergePolicy) conf.getMergePolicy()).setMergeFactor(3);
+    IndexWriter writer = new MockIndexWriter(directory, conf);
 
     // Establish a base index of 100 docs:
     for(int i=0;i<100;i++) {

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java Tue Mar 23 18:52:19 2010
@@ -480,9 +480,10 @@ public class TestBackwardsCompatibility 
     dirName = fullDir(dirName);
 
     Directory dir = FSDirectory.open(new File(dirName));
-    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(10));
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(doCFS);
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(doCFS);
+    IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(10);
+    ((LogMergePolicy) conf.getMergePolicy()).setUseCompoundFile(doCFS);
+    ((LogMergePolicy) conf.getMergePolicy()).setUseCompoundDocStore(doCFS);
+    IndexWriter writer = new IndexWriter(dir, conf);
     
     for(int i=0;i<35;i++) {
       addDoc(writer, i);
@@ -491,9 +492,10 @@ public class TestBackwardsCompatibility 
     writer.close();
 
     // open fresh writer so we get no prx file in the added segment
-    writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(10));
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(doCFS);
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(doCFS);
+    conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(10);
+    ((LogMergePolicy) conf.getMergePolicy()).setUseCompoundFile(doCFS);
+    ((LogMergePolicy) conf.getMergePolicy()).setUseCompoundDocStore(doCFS);
+    writer = new IndexWriter(dir, conf);
     addNoProxDoc(writer);
     writer.close();
 

Propchange: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 23 18:52:19 2010
@@ -1,4 +1,4 @@
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:748824
 /lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:829134,829881,831036,896850,909334
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:880793,896906
-/lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:824912-825292,826213-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919060,919119,919718,919731,919869,920237-920499,922013,922277,922525,922528,922583,922593,922602,922624,922797,922799,922806,922886-922887,923112,923238,924151,924207,924286,924321-924731,924781
+/lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:824912-825292,826213-833960,880727-886190,889185,889614-916543,916596,916685,916755,916769,917019,917148,917154,917161,917203-917204,919060,919119,919718,919731,919869,920237-920499,922013,922277,922525,922528,922583,922593,922602,922624,922797,922799,922806,922886-922887,923112,923238,924151,924207,924286,924321-924731,924781,925176-925462

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java Tue Mar 23 18:52:19 2010
@@ -109,15 +109,14 @@ public class TestConcurrentMergeSchedule
 
     RAMDirectory directory = new MockRAMDirectory();
 
-    IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)));
-
-    LogDocMergePolicy mp = new LogDocMergePolicy(writer);
-    writer.setMergePolicy(mp);
-
+    LogDocMergePolicy mp = new LogDocMergePolicy();
     // Force degenerate merging so we can get a mix of
     // merging of segments with and without deletes at the
     // start:
     mp.setMinMergeDocs(1000);
+    IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(
+        TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT))
+        .setMergePolicy(mp));
 
     Document doc = new Document();
     Field idField = new Field("id", "", Field.Store.YES, Field.Index.NOT_ANALYZED);
@@ -183,7 +182,7 @@ public class TestConcurrentMergeSchedule
     doc.add(idField);
 
     IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(100);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(100);
 
     for(int iter=0;iter<10;iter++) {
 
@@ -200,7 +199,7 @@ public class TestConcurrentMergeSchedule
 
       // Force a bunch of merge threads to kick off so we
       // stress out aborting them on close:
-      ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(3);
+      ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(3);
       writer.addDocument(doc);
       writer.commit();
 
@@ -212,7 +211,7 @@ public class TestConcurrentMergeSchedule
 
       // Reopen
       writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND));
-      ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(100);
+      ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(100);
     }
     writer.close();
 

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestDeletionPolicy.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestDeletionPolicy.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestDeletionPolicy.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestDeletionPolicy.java Tue Mar 23 18:52:19 2010
@@ -202,10 +202,13 @@ public class TestDeletionPolicy extends 
 
     Directory dir = new RAMDirectory();
     ExpirationTimeDeletionPolicy policy = new ExpirationTimeDeletionPolicy(dir, SECONDS);
-    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setIndexDeletionPolicy(policy));
-    LogMergePolicy lmp = (LogMergePolicy) writer.getMergePolicy();
+    IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT,
+        new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+        .setIndexDeletionPolicy(policy);
+    LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy();
     lmp.setUseCompoundFile(useCompoundFile);
     lmp.setUseCompoundDocStore(useCompoundFile);
+    IndexWriter writer = new IndexWriter(dir, conf);
     writer.close();
 
     long lastDeleteTime = 0;
@@ -213,11 +216,13 @@ public class TestDeletionPolicy extends 
       // Record last time when writer performed deletes of
       // past commits
       lastDeleteTime = System.currentTimeMillis();
-      writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
-          .setOpenMode(OpenMode.APPEND).setIndexDeletionPolicy(policy));
-      lmp = (LogMergePolicy) writer.getMergePolicy();
+      conf = new IndexWriterConfig(TEST_VERSION_CURRENT,
+          new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(
+          OpenMode.APPEND).setIndexDeletionPolicy(policy);
+      lmp = (LogMergePolicy) conf.getMergePolicy();
       lmp.setUseCompoundFile(useCompoundFile);
       lmp.setUseCompoundDocStore(useCompoundFile);
+      writer = new IndexWriter(dir, conf);
       for(int j=0;j<17;j++) {
         addDoc(writer);
       }
@@ -277,24 +282,26 @@ public class TestDeletionPolicy extends 
       Directory dir = new RAMDirectory();
       policy.dir = dir;
 
-      IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+      IndexWriterConfig conf = new IndexWriterConfig(
           TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
           .setIndexDeletionPolicy(policy).setMaxBufferedDocs(10)
-          .setMergeScheduler(new SerialMergeScheduler()));
-      LogMergePolicy lmp = (LogMergePolicy) writer.getMergePolicy();
+          .setMergeScheduler(new SerialMergeScheduler());
+      LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy();
       lmp.setUseCompoundFile(useCompoundFile);
       lmp.setUseCompoundDocStore(useCompoundFile);
+      IndexWriter writer = new IndexWriter(dir, conf);
       for(int i=0;i<107;i++) {
         addDoc(writer);
       }
       writer.close();
 
-      writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT,
+      conf = new IndexWriterConfig(TEST_VERSION_CURRENT,
           new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(
-          OpenMode.APPEND).setIndexDeletionPolicy(policy));
-      lmp = (LogMergePolicy) writer.getMergePolicy();
+          OpenMode.APPEND).setIndexDeletionPolicy(policy);
+      lmp = (LogMergePolicy) conf.getMergePolicy();
       lmp.setUseCompoundFile(useCompoundFile);
       lmp.setUseCompoundDocStore(useCompoundFile);
+      writer = new IndexWriter(dir, conf);
       writer.optimize();
       writer.close();
 
@@ -462,23 +469,25 @@ public class TestDeletionPolicy extends 
 
       Directory dir = new RAMDirectory();
 
-      IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+      IndexWriterConfig conf = new IndexWriterConfig(
           TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
           .setOpenMode(OpenMode.CREATE).setIndexDeletionPolicy(policy)
-          .setMaxBufferedDocs(10));
-      LogMergePolicy lmp = (LogMergePolicy) writer.getMergePolicy();
+          .setMaxBufferedDocs(10);
+      LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy();
       lmp.setUseCompoundFile(useCompoundFile);
       lmp.setUseCompoundDocStore(useCompoundFile);
+      IndexWriter writer = new IndexWriter(dir, conf);
       for(int i=0;i<107;i++) {
         addDoc(writer);
       }
       writer.close();
 
-      writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
-          .setOpenMode(OpenMode.APPEND).setIndexDeletionPolicy(policy));
-      lmp = (LogMergePolicy) writer.getMergePolicy();
+      conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+          .setOpenMode(OpenMode.APPEND).setIndexDeletionPolicy(policy);
+      lmp = (LogMergePolicy) conf.getMergePolicy();
       lmp.setUseCompoundFile(useCompoundFile);
       lmp.setUseCompoundDocStore(useCompoundFile);
+      writer = new IndexWriter(dir, conf);
       writer.optimize();
       writer.close();
 
@@ -512,13 +521,14 @@ public class TestDeletionPolicy extends 
       KeepLastNDeletionPolicy policy = new KeepLastNDeletionPolicy(N);
 
       for(int j=0;j<N+1;j++) {
-        IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+        IndexWriterConfig conf = new IndexWriterConfig(
             TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
             .setOpenMode(OpenMode.CREATE).setIndexDeletionPolicy(policy)
-            .setMaxBufferedDocs(10));
-        LogMergePolicy lmp = (LogMergePolicy) writer.getMergePolicy();
+            .setMaxBufferedDocs(10);
+        LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy();
         lmp.setUseCompoundFile(useCompoundFile);
         lmp.setUseCompoundDocStore(useCompoundFile);
+        IndexWriter writer = new IndexWriter(dir, conf);
         for(int i=0;i<17;i++) {
           addDoc(writer);
         }
@@ -571,23 +581,25 @@ public class TestDeletionPolicy extends 
       KeepLastNDeletionPolicy policy = new KeepLastNDeletionPolicy(N);
 
       Directory dir = new RAMDirectory();
-      IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+      IndexWriterConfig conf = new IndexWriterConfig(
           TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
-          .setOpenMode(OpenMode.CREATE).setIndexDeletionPolicy(policy));
-      LogMergePolicy lmp = (LogMergePolicy) writer.getMergePolicy();
+          .setOpenMode(OpenMode.CREATE).setIndexDeletionPolicy(policy);
+      LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy();
       lmp.setUseCompoundFile(useCompoundFile);
       lmp.setUseCompoundDocStore(useCompoundFile);
+      IndexWriter writer = new IndexWriter(dir, conf);
       writer.close();
       Term searchTerm = new Term("content", "aaa");        
       Query query = new TermQuery(searchTerm);
 
       for(int i=0;i<N+1;i++) {
-        writer = new IndexWriter(dir, new IndexWriterConfig(
+        conf = new IndexWriterConfig(
             TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
-            .setOpenMode(OpenMode.APPEND).setIndexDeletionPolicy(policy));
-        lmp = (LogMergePolicy) writer.getMergePolicy();
+            .setOpenMode(OpenMode.APPEND).setIndexDeletionPolicy(policy);
+        lmp = (LogMergePolicy) conf.getMergePolicy();
         lmp.setUseCompoundFile(useCompoundFile);
         lmp.setUseCompoundDocStore(useCompoundFile);
+        writer = new IndexWriter(dir, conf);
         for(int j=0;j<17;j++) {
           addDoc(writer);
         }
@@ -603,11 +615,12 @@ public class TestDeletionPolicy extends 
         reader.close();
         searcher.close();
       }
-      writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
-          .setOpenMode(OpenMode.APPEND).setIndexDeletionPolicy(policy));
-      lmp = (LogMergePolicy) writer.getMergePolicy();
+      conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+          .setOpenMode(OpenMode.APPEND).setIndexDeletionPolicy(policy);
+      lmp = (LogMergePolicy) conf.getMergePolicy();
       lmp.setUseCompoundFile(useCompoundFile);
       lmp.setUseCompoundDocStore(useCompoundFile);
+      writer = new IndexWriter(dir, conf);
       writer.optimize();
       // this is a commit
       writer.close();
@@ -677,26 +690,28 @@ public class TestDeletionPolicy extends 
       KeepLastNDeletionPolicy policy = new KeepLastNDeletionPolicy(N);
 
       Directory dir = new RAMDirectory();
-      IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+      IndexWriterConfig conf = new IndexWriterConfig(
           TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
           .setOpenMode(OpenMode.CREATE).setIndexDeletionPolicy(policy)
-          .setMaxBufferedDocs(10));
-      LogMergePolicy lmp = (LogMergePolicy) writer.getMergePolicy();
+          .setMaxBufferedDocs(10);
+      LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy();
       lmp.setUseCompoundFile(useCompoundFile);
       lmp.setUseCompoundDocStore(useCompoundFile);
+      IndexWriter writer = new IndexWriter(dir, conf);
       writer.close();
       Term searchTerm = new Term("content", "aaa");        
       Query query = new TermQuery(searchTerm);
 
       for(int i=0;i<N+1;i++) {
 
-        writer = new IndexWriter(dir, new IndexWriterConfig(
+        conf = new IndexWriterConfig(
             TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
             .setOpenMode(OpenMode.APPEND).setIndexDeletionPolicy(policy)
-            .setMaxBufferedDocs(10));
-        lmp = (LogMergePolicy) writer.getMergePolicy();
+            .setMaxBufferedDocs(10);
+        lmp = (LogMergePolicy) conf.getMergePolicy();
         lmp.setUseCompoundFile(useCompoundFile);
         lmp.setUseCompoundDocStore(useCompoundFile);
+        writer = new IndexWriter(dir, conf);
         for(int j=0;j<17;j++) {
           addDoc(writer);
         }

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestFieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestFieldsReader.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestFieldsReader.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestFieldsReader.java Tue Mar 23 18:52:19 2010
@@ -60,9 +60,10 @@ public class TestFieldsReader extends Lu
     fieldInfos = new FieldInfos();
     DocHelper.setupDoc(testDoc);
     fieldInfos.add(testDoc);
-    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)));
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(false);
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(false);
+    IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
+    ((LogMergePolicy) conf.getMergePolicy()).setUseCompoundFile(false);
+    ((LogMergePolicy) conf.getMergePolicy()).setUseCompoundDocStore(false);
+    IndexWriter writer = new IndexWriter(dir, conf);
     writer.addDocument(testDoc);
     writer.close();
   }
@@ -216,8 +217,9 @@ public class TestFieldsReader extends Lu
     FSDirectory tmpDir = FSDirectory.open(file);
     assertTrue(tmpDir != null);
 
-    IndexWriter writer = new IndexWriter(tmpDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE));
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(false);
+    IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE);
+    ((LogMergePolicy) conf.getMergePolicy()).setUseCompoundFile(false);
+    IndexWriter writer = new IndexWriter(tmpDir, conf);
     writer.addDocument(testDoc);
     writer.close();
 

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexFileDeleter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexFileDeleter.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexFileDeleter.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexFileDeleter.java Tue Mar 23 18:52:19 2010
@@ -41,13 +41,15 @@ public class TestIndexFileDeleter extend
 
     Directory dir = new RAMDirectory();
 
-    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(10));
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+        .setMaxBufferedDocs(10));
     int i;
     for(i=0;i<35;i++) {
       addDoc(writer, i);
     }
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(false);
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(false);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false);
     for(;i<45;i++) {
       addDoc(writer, i);
     }

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReader.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReader.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReader.java Tue Mar 23 18:52:19 2010
@@ -175,7 +175,7 @@ public class TestIndexReader extends Luc
         writer = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT,
             new StandardAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND));
         // want to get some more segments here
-        int mergeFactor = ((LogMergePolicy) writer.getMergePolicy()).getMergeFactor();
+        int mergeFactor = ((LogMergePolicy) writer.getConfig().getMergePolicy()).getMergeFactor();
         for (int i = 0; i < 5*mergeFactor; i++) {
             addDocumentWithFields(writer);
         }
@@ -255,7 +255,7 @@ public class TestIndexReader extends Luc
         TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT)));
     // want to get some more segments here
     // new termvector fields
-    int mergeFactor = ((LogMergePolicy) writer.getMergePolicy()).getMergeFactor();
+    int mergeFactor = ((LogMergePolicy) writer.getConfig().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));
@@ -559,8 +559,8 @@ public class TestIndexReader extends Luc
 
         //  add 1 documents with term : aaa
         writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)));
-        ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(false);
-        ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(false);
+        ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false);
+        ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false);
         addDoc(writer, searchTerm.text());
         writer.close();
 

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderClone.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderClone.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderClone.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderClone.java Tue Mar 23 18:52:19 2010
@@ -487,8 +487,8 @@ public class TestIndexReaderClone extend
     final Directory dir = new MockRAMDirectory();
     IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(
         TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)));
-    ((LogMergePolicy) w.getMergePolicy()).setUseCompoundFile(false);
-    ((LogMergePolicy) w.getMergePolicy()).setUseCompoundDocStore(false);
+    ((LogMergePolicy) w.getConfig().getMergePolicy()).setUseCompoundFile(false);
+    ((LogMergePolicy) w.getConfig().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/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java Tue Mar 23 18:52:19 2010
@@ -116,7 +116,7 @@ public class TestIndexReaderCloneNorms e
     IndexWriter iw = new IndexWriter(dir3, new IndexWriterConfig(
         TEST_VERSION_CURRENT, anlzr).setOpenMode(OpenMode.APPEND)
         .setMaxBufferedDocs(5));
-    ((LogMergePolicy) iw.getMergePolicy()).setMergeFactor(3);
+    ((LogMergePolicy) iw.getConfig().getMergePolicy()).setMergeFactor(3);
     iw.addIndexesNoOptimize(new Directory[] { dir1, dir2 });
     iw.optimize();
     iw.close();
@@ -134,7 +134,7 @@ public class TestIndexReaderCloneNorms e
     // now with optimize
     iw = new IndexWriter(dir3, new IndexWriterConfig(TEST_VERSION_CURRENT,
         anlzr).setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(5));
-    ((LogMergePolicy) iw.getMergePolicy()).setMergeFactor(3);
+    ((LogMergePolicy) iw.getConfig().getMergePolicy()).setMergeFactor(3);
     iw.optimize();
     iw.close();
     verifyIndex(dir3);
@@ -236,7 +236,7 @@ public class TestIndexReaderCloneNorms e
     IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(
         TEST_VERSION_CURRENT, anlzr).setOpenMode(OpenMode.CREATE)
         .setMaxBufferedDocs(5).setSimilarity(similarityOne));
-    LogMergePolicy lmp = (LogMergePolicy) iw.getMergePolicy();
+    LogMergePolicy lmp = (LogMergePolicy) iw.getConfig().getMergePolicy();
     lmp.setMergeFactor(3);
     lmp.setUseCompoundFile(true);
     lmp.setUseCompoundDocStore(true);
@@ -286,13 +286,14 @@ public class TestIndexReaderCloneNorms e
 
   private void addDocs(Directory dir, int ndocs, boolean compound)
       throws IOException {
-    IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(
-        TEST_VERSION_CURRENT, anlzr).setOpenMode(OpenMode.APPEND)
-        .setMaxBufferedDocs(5).setSimilarity(similarityOne));
-    LogMergePolicy lmp = (LogMergePolicy) iw.getMergePolicy();
+    IndexWriterConfig conf = new IndexWriterConfig(
+            TEST_VERSION_CURRENT, anlzr).setOpenMode(OpenMode.APPEND)
+            .setMaxBufferedDocs(5).setSimilarity(similarityOne);
+    LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy();
     lmp.setMergeFactor(3);
     lmp.setUseCompoundFile(compound);
     lmp.setUseCompoundDocStore(compound);
+    IndexWriter iw = new IndexWriter(dir, conf);
     for (int i = 0; i < ndocs; i++) {
       iw.addDocument(newDoc());
     }

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderReopen.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderReopen.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderReopen.java Tue Mar 23 18:52:19 2010
@@ -951,9 +951,9 @@ public class TestIndexReaderReopen exten
   
   public static void createIndex(Directory dir, boolean multiSegment) throws IOException {
     IndexWriter.unlock(dir);
-    IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)));
-
-    w.setMergePolicy(new LogDocMergePolicy(w));
+    IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(
+        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+        .setMergePolicy(new LogDocMergePolicy()));
     
     for (int i = 0; i < 100; i++) {
       w.addDocument(createDocument(i, 4));

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriter.java Tue Mar 23 18:52:19 2010
@@ -609,13 +609,13 @@ public class TestIndexWriter extends Luc
       doc.add(new Field("content", "aaa", Field.Store.YES, Field.Index.ANALYZED));
 
       for(int numDocs=38;numDocs<500;numDocs += 38) {
-        IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
-          TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE)
-          .setMaxBufferedDocs(2));
-        LogDocMergePolicy ldmp = new LogDocMergePolicy(writer);
+        LogDocMergePolicy ldmp = new LogDocMergePolicy();
         ldmp.setMinMergeDocs(1);
         ldmp.setMergeFactor(5);
-        writer.setMergePolicy(ldmp);
+        IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+          TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+          .setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(2).setMergePolicy(
+              ldmp));
         for(int j=0;j<numDocs;j++)
           writer.addDocument(doc);
         writer.close();
@@ -624,9 +624,10 @@ public class TestIndexWriter extends Luc
         sis.read(dir);
         final int segCount = sis.size();
 
-        writer  = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)));
+        ldmp = new LogDocMergePolicy();
         ldmp.setMergeFactor(5);
-        writer.setMergePolicy(ldmp);
+        writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT,
+          new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMergePolicy(ldmp));
         writer.optimize(3);
         writer.close();
 
@@ -647,12 +648,12 @@ public class TestIndexWriter extends Luc
       final Document doc = new Document();
       doc.add(new Field("content", "aaa", Field.Store.YES, Field.Index.ANALYZED));
 
-      IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
-        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2));
-      LogDocMergePolicy ldmp = new LogDocMergePolicy(writer);
+      LogDocMergePolicy ldmp = new LogDocMergePolicy();
       ldmp.setMinMergeDocs(1);
       ldmp.setMergeFactor(4);
-      writer.setMergePolicy(ldmp);
+      IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+        .setMaxBufferedDocs(2).setMergePolicy(ldmp));
 
       for(int iter=0;iter<10;iter++) {
         for(int i=0;i<19;i++)
@@ -1529,9 +1530,9 @@ public class TestIndexWriter extends Luc
       Directory dir = new MockRAMDirectory();
       for(int pass=0;pass<2;pass++) {
         IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
-          TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE)
-          .setMaxBufferedDocs(2));
-        ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(101);
+          TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+          .setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(2));
+        ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(101);
         Document doc = new Document();
         doc.add(new Field("field", "aaa", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
         for(int i=0;i<200;i++)
@@ -1655,10 +1656,11 @@ public class TestIndexWriter extends Luc
     int pri = Thread.currentThread().getPriority();
     try {
       MockRAMDirectory dir = new MockRAMDirectory();
-      IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(
+      IndexWriterConfig conf = new IndexWriterConfig(
           TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))
-          .setMaxBufferedDocs(2));
-      ((LogMergePolicy) iw.getMergePolicy()).setMergeFactor(2);
+          .setMaxBufferedDocs(2);
+      ((LogMergePolicy) conf.getMergePolicy()).setMergeFactor(2);
+      IndexWriter iw = new IndexWriter(dir, conf);
       Document document = new Document();
       document.add(new Field("tvtest", "a b c", Field.Store.NO, Field.Index.ANALYZED,
                              Field.TermVector.YES));
@@ -1696,12 +1698,13 @@ public class TestIndexWriter extends Luc
   // LUCENE-1013
   public void testSetMaxMergeDocs() throws IOException {
     MockRAMDirectory dir = new MockRAMDirectory();
-    IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(
+    IndexWriterConfig conf = new IndexWriterConfig(
         TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))
-        .setMergeScheduler(new MyMergeScheduler()).setMaxBufferedDocs(2));
-    LogMergePolicy lmp = (LogMergePolicy) iw.getMergePolicy();
+        .setMergeScheduler(new MyMergeScheduler()).setMaxBufferedDocs(2);
+    LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy();
     lmp.setMaxMergeDocs(20);
     lmp.setMergeFactor(2);
+    IndexWriter iw = new IndexWriter(dir, conf);
     Document document = new Document();
     document.add(new Field("tvtest", "a b c", Field.Store.NO, Field.Index.ANALYZED,
                            Field.TermVector.YES));
@@ -2063,7 +2066,7 @@ public class TestIndexWriter extends Luc
     int delID = 0;
     for(int i=0;i<20;i++) {
       IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2));
-      LogMergePolicy lmp = (LogMergePolicy) writer.getMergePolicy();
+      LogMergePolicy lmp = (LogMergePolicy) writer.getConfig().getMergePolicy();
       lmp.setMergeFactor(2);
       lmp.setUseCompoundFile(false);
       lmp.setUseCompoundDocStore(false);
@@ -2100,7 +2103,7 @@ public class TestIndexWriter extends Luc
 
       if (0 == i % 4) {
         writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)));
-        LogMergePolicy lmp2 = (LogMergePolicy) writer.getMergePolicy();
+        LogMergePolicy lmp2 = (LogMergePolicy) writer.getConfig().getMergePolicy();
         lmp2.setUseCompoundFile(false);
         lmp2.setUseCompoundDocStore(false);
         writer.optimize();
@@ -2125,7 +2128,7 @@ public class TestIndexWriter extends Luc
         conf.setMergeScheduler(new SerialMergeScheduler());
       }
       IndexWriter writer = new IndexWriter(directory, conf);
-      ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(100);
+      ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(100);
       
       //System.out.println("TEST: pass=" + pass + " cms=" + (pass >= 2));
       for(int iter=0;iter<10;iter++) {
@@ -2143,7 +2146,7 @@ public class TestIndexWriter extends Luc
 
         // Force a bunch of merge threads to kick off so we
         // stress out aborting them on close:
-        ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(2);
+        ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2);
 
         final IndexWriter finalWriter = writer;
         final ArrayList<Throwable> failure = new ArrayList<Throwable>();
@@ -2271,7 +2274,7 @@ public class TestIndexWriter extends Luc
       // We expect AlreadyClosedException
       ((ConcurrentMergeScheduler) conf.getMergeScheduler()).setSuppressExceptions();
       IndexWriter writer = new IndexWriter(dir, conf);
-      ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(4);
+      ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4);
 
       IndexerThread[] threads = new IndexerThread[NUM_THREADS];
 
@@ -2363,7 +2366,7 @@ public class TestIndexWriter extends Luc
       // We expect disk full exceptions in the merge threads
       ((ConcurrentMergeScheduler) conf.getMergeScheduler()).setSuppressExceptions();
       IndexWriter writer = new IndexWriter(dir, conf);
-      ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(4);
+      ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4);
       dir.setMaxSizeInBytes(4*1024+20*iter);
 
       IndexerThread[] threads = new IndexerThread[NUM_THREADS];
@@ -2452,7 +2455,7 @@ public class TestIndexWriter extends Luc
       // We expect disk full exceptions in the merge threads
       ((ConcurrentMergeScheduler) conf.getMergeScheduler()).setSuppressExceptions();
       IndexWriter writer = new IndexWriter(dir, conf);
-      ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(4);
+      ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4);
 
       IndexerThread[] threads = new IndexerThread[NUM_THREADS];
 
@@ -2669,7 +2672,7 @@ public class TestIndexWriter extends Luc
     IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
         TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
         .setMaxBufferedDocs(2));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(5);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(5);
 
     for (int i = 0; i < 23; i++)
       addDoc(writer);
@@ -2723,7 +2726,7 @@ public class TestIndexWriter extends Luc
 
     IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2));
     failure.setDoFail();
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(5);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(5);
 
     for (int i = 0; i < 23; i++) {
       addDoc(writer);
@@ -2753,10 +2756,11 @@ public class TestIndexWriter extends Luc
     Directory dir = new MockRAMDirectory();
     for(int iter=0;iter<2;iter++) {
       IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
-          TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2).setRAMBufferSizeMB(
-          IndexWriterConfig.DISABLE_AUTO_FLUSH).setMergeScheduler(
-          new SerialMergeScheduler()));
-      writer.setMergePolicy(new LogDocMergePolicy(writer));
+          TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))
+          .setMaxBufferedDocs(2).setRAMBufferSizeMB(
+              IndexWriterConfig.DISABLE_AUTO_FLUSH).setMergeScheduler(
+              new SerialMergeScheduler()).setMergePolicy(
+              new LogDocMergePolicy()));
 
       Document document = new Document();
 
@@ -2787,8 +2791,8 @@ public class TestIndexWriter extends Luc
       writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT,
           new StandardAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2)
           .setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH)
-          .setMergeScheduler(new SerialMergeScheduler()));
-      writer.setMergePolicy(new LogDocMergePolicy(writer));
+          .setMergeScheduler(new SerialMergeScheduler()).setMergePolicy(
+              new LogDocMergePolicy()));
 
       Directory[] indexDirs = {new MockRAMDirectory(dir)};
       writer.addIndexesNoOptimize(indexDirs);
@@ -2806,8 +2810,8 @@ public class TestIndexWriter extends Luc
           TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))
           .setMaxBufferedDocs(2).setRAMBufferSizeMB(
               IndexWriterConfig.DISABLE_AUTO_FLUSH).setMergeScheduler(
-              new SerialMergeScheduler()));
-      writer.setMergePolicy(new LogDocMergePolicy(writer));
+              new SerialMergeScheduler()).setMergePolicy(
+              new LogDocMergePolicy()));
 
       Document document = new Document();
 
@@ -2843,8 +2847,7 @@ public class TestIndexWriter extends Luc
         TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))
         .setMaxBufferedDocs(2).setRAMBufferSizeMB(
             IndexWriterConfig.DISABLE_AUTO_FLUSH).setMergeScheduler(
-            new SerialMergeScheduler()));
-    writer.setMergePolicy(new LogDocMergePolicy(writer));
+            new SerialMergeScheduler()).setMergePolicy(new LogDocMergePolicy()));
 
     Document document = new Document();
 
@@ -2863,8 +2866,8 @@ public class TestIndexWriter extends Luc
     writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT,
         new StandardAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2)
         .setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH)
-        .setMergeScheduler(new SerialMergeScheduler()));
-    writer.setMergePolicy(new LogDocMergePolicy(writer));
+        .setMergeScheduler(new SerialMergeScheduler()).setMergePolicy(
+            new LogDocMergePolicy()));
     for(int i=0;i<6;i++)
       writer.addDocument(document);
 
@@ -2954,7 +2957,7 @@ public class TestIndexWriter extends Luc
         TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))
         .setMaxBufferedDocs(2).setRAMBufferSizeMB(
             IndexWriterConfig.DISABLE_AUTO_FLUSH));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(50);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(50);
 
     Document document = new Document();
 
@@ -2980,7 +2983,7 @@ public class TestIndexWriter extends Luc
 
     writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT,
         new StandardAnalyzer(TEST_VERSION_CURRENT)));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(3);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(3);
     assertEquals(49, writer.numDocs());
     writer.expungeDeletes();
     writer.close();
@@ -2999,7 +3002,7 @@ public class TestIndexWriter extends Luc
         TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))
         .setMaxBufferedDocs(2).setRAMBufferSizeMB(
             IndexWriterConfig.DISABLE_AUTO_FLUSH));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(50);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(50);
 
     Document document = new Document();
 
@@ -3025,7 +3028,7 @@ public class TestIndexWriter extends Luc
 
     writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT)));
     // Force many merges to happen
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(3);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(3);
     writer.expungeDeletes(false);
     writer.close();
     ir = IndexReader.open(dir, true);
@@ -3135,8 +3138,9 @@ public class TestIndexWriter extends Luc
   // LUCENE-1210
   public void testExceptionOnMergeInit() throws IOException {
     MockRAMDirectory dir = new MockRAMDirectory();
-    MockIndexWriter2 w = new MockIndexWriter2(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2));
-    ((LogMergePolicy) w.getMergePolicy()).setMergeFactor(2);
+    IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2);
+    ((LogMergePolicy) conf.getMergePolicy()).setMergeFactor(2);
+    MockIndexWriter2 w = new MockIndexWriter2(dir, conf);
     w.doFail = true;
     Document doc = new Document();
     doc.add(new Field("field", "a field", Field.Store.YES,
@@ -3529,7 +3533,7 @@ public class TestIndexWriter extends Luc
     Directory dir = new MockRAMDirectory();
 
     IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(5);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(5);
 
     for (int i = 0; i < 23; i++)
       addDoc(writer);
@@ -3580,7 +3584,7 @@ public class TestIndexWriter extends Luc
     dir.setPreventDoubleWrite(false);
 
     IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(5);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(5);
 
     for (int i = 0; i < 23; i++)
       addDoc(writer);
@@ -4017,15 +4021,16 @@ public class TestIndexWriter extends Luc
 
   public void testOptimizeExceptions() throws IOException {
     RAMDirectory startDir = new MockRAMDirectory();
-    IndexWriter w = new IndexWriter(startDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2));
-    ((LogMergePolicy) w.getMergePolicy()).setMergeFactor(100);
+    IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2);
+    ((LogMergePolicy) conf.getMergePolicy()).setMergeFactor(100);
+    IndexWriter w = new IndexWriter(startDir, conf);
     for(int i=0;i<27;i++)
       addDoc(w);
     w.close();
 
     for(int i=0;i<200;i++) {
       MockRAMDirectory dir = new MockRAMDirectory(startDir);
-      IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
+      conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
       ((ConcurrentMergeScheduler) conf.getMergeScheduler()).setSuppressExceptions();
       w = new IndexWriter(dir, conf);
       dir.setRandomIOExceptionRate(0.5, 100);
@@ -4390,8 +4395,11 @@ public class TestIndexWriter extends Luc
             if (w != null) {
               w.close();
             }
-            w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2));
-            ((LogMergePolicy) w.getMergePolicy()).setMergeFactor(2);
+            IndexWriterConfig conf = new IndexWriterConfig(
+                TEST_VERSION_CURRENT, new WhitespaceAnalyzer(
+                    TEST_VERSION_CURRENT)).setMaxBufferedDocs(2);
+            ((LogMergePolicy) conf.getMergePolicy()).setMergeFactor(2);
+            w = new IndexWriter(dir, conf);
 
             //((ConcurrentMergeScheduler) w.getMergeScheduler()).setSuppressExceptions();
             if (!first && !allowInterrupt) {
@@ -4611,7 +4619,7 @@ public class TestIndexWriter extends Luc
     Directory dir = new MockRAMDirectory();
     IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
         TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)));
-    LogMergePolicy lmp = (LogMergePolicy) writer.getMergePolicy();
+    LogMergePolicy lmp = (LogMergePolicy) writer.getConfig().getMergePolicy();
     lmp.setUseCompoundFile(false);
     lmp.setUseCompoundDocStore(false);
     ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterConfig.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterConfig.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterConfig.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterConfig.java Tue Mar 23 18:52:19 2010
@@ -82,6 +82,8 @@ public class TestIndexWriterConfig exten
     assertTrue(DocumentsWriter.defaultIndexingChain == conf.getIndexingChain());
     assertNull(conf.getMergedSegmentWarmer());
     assertEquals(IndexWriterConfig.DEFAULT_CODEC_PROVIDER, CodecProvider.getDefault());
+    assertEquals(IndexWriterConfig.DEFAULT_MAX_THREAD_STATES, conf.getMaxThreadStates());
+    assertEquals(LogByteSizeMergePolicy.class, conf.getMergePolicy().getClass());
     
     // Sanity check - validate that all getters are covered.
     Set<String> getters = new HashSet<String>();
@@ -101,6 +103,7 @@ public class TestIndexWriterConfig exten
     getters.add("getIndexingChain");
     getters.add("getMergedSegmentWarmer");
     getters.add("getCodecProvider");
+    getters.add("getMergePolicy");
     getters.add("getMaxThreadStates");
     for (Method m : IndexWriterConfig.class.getDeclaredMethods()) {
       if (m.getDeclaringClass() == IndexWriterConfig.class && m.getName().startsWith("get")) {
@@ -133,6 +136,7 @@ public class TestIndexWriterConfig exten
     assertEquals(IndexWriterConfig.DISABLE_AUTO_FLUSH, IndexWriterConfig.DEFAULT_MAX_BUFFERED_DELETE_TERMS);
     assertEquals(IndexWriterConfig.DISABLE_AUTO_FLUSH, IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS);
     assertEquals(16.0, IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB, 0.0);
+    assertEquals(8, IndexWriterConfig.DEFAULT_MAX_THREAD_STATES);
   }
   
   @Test
@@ -228,7 +232,19 @@ public class TestIndexWriterConfig exten
     } catch (IllegalArgumentException e) {
       // this is expected
     }
-    
+
+    assertEquals(IndexWriterConfig.DEFAULT_MAX_THREAD_STATES, conf.getMaxThreadStates());
+    conf.setMaxThreadStates(5);
+    assertEquals(5, conf.getMaxThreadStates());
+    conf.setMaxThreadStates(0);
+    assertEquals(IndexWriterConfig.DEFAULT_MAX_THREAD_STATES, conf.getMaxThreadStates());
+    
+    // Test MergePolicy
+    assertEquals(LogByteSizeMergePolicy.class, conf.getMergePolicy().getClass());
+    conf.setMergePolicy(new LogDocMergePolicy());
+    assertEquals(LogDocMergePolicy.class, conf.getMergePolicy().getClass());
+    conf.setMergePolicy(null);
+    assertEquals(LogByteSizeMergePolicy.class, conf.getMergePolicy().getClass());
   }
 
   /**
@@ -271,5 +287,9 @@ public class TestIndexWriterConfig exten
     
     writer.setMergedSegmentWarmer(new MyWarmer());
     assertEquals(MyWarmer.class, writer.getConfig().getMergedSegmentWarmer().getClass());
+    
+    writer.setMergePolicy(new LogDocMergePolicy());
+    assertEquals(LogDocMergePolicy.class, writer.getConfig().getMergePolicy().getClass());
   }
+
 }

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterDelete.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterDelete.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterDelete.java Tue Mar 23 18:52:19 2010
@@ -640,7 +640,7 @@ public class TestIndexWriterDelete exten
     MockRAMDirectory dir = new MockRAMDirectory();
     IndexWriter modifier = new IndexWriter(dir, new IndexWriterConfig(
         TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDeleteTerms(2));
-    LogMergePolicy lmp = (LogMergePolicy) modifier.getMergePolicy();
+    LogMergePolicy lmp = (LogMergePolicy) modifier.getConfig().getMergePolicy();
     lmp.setUseCompoundFile(true);
     lmp.setUseCompoundDocStore(true);
 

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java Tue Mar 23 18:52:19 2010
@@ -35,9 +35,9 @@ public class TestIndexWriterMergePolicy 
   public void testNormalCase() throws IOException {
     Directory dir = new RAMDirectory();
 
-    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(10));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(10);
-    writer.setMergePolicy(new LogDocMergePolicy(writer));
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+        .setMaxBufferedDocs(10).setMergePolicy(new LogDocMergePolicy()));
 
     for (int i = 0; i < 100; i++) {
       addDoc(writer);
@@ -51,9 +51,9 @@ public class TestIndexWriterMergePolicy 
   public void testNoOverMerge() throws IOException {
     Directory dir = new RAMDirectory();
 
-    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(10));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(10);
-    writer.setMergePolicy(new LogDocMergePolicy(writer));
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+        .setMaxBufferedDocs(10).setMergePolicy(new LogDocMergePolicy()));
 
     boolean noOverMerge = false;
     for (int i = 0; i < 100; i++) {
@@ -72,21 +72,23 @@ public class TestIndexWriterMergePolicy 
   public void testForceFlush() throws IOException {
     Directory dir = new RAMDirectory();
 
-    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(10));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(10);
-    LogDocMergePolicy mp = new LogDocMergePolicy(writer);
+    LogDocMergePolicy mp = new LogDocMergePolicy();
     mp.setMinMergeDocs(100);
-    writer.setMergePolicy(mp);
+    mp.setMergeFactor(10);
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+        .setMaxBufferedDocs(10).setMergePolicy(mp));
 
     for (int i = 0; i < 100; i++) {
       addDoc(writer);
       writer.close();
 
-      writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
-          .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(10));
-      writer.setMergePolicy(mp);
+      mp = new LogDocMergePolicy();
+      mp.setMergeFactor(10);
+      writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT,
+          new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(
+          OpenMode.APPEND).setMaxBufferedDocs(10).setMergePolicy(mp));
       mp.setMinMergeDocs(100);
-      ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(10);
       checkInvariants(writer);
     }
 
@@ -97,16 +99,16 @@ public class TestIndexWriterMergePolicy 
   public void testMergeFactorChange() throws IOException {
     Directory dir = new RAMDirectory();
 
-    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(10));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(100);
-    writer.setMergePolicy(new LogDocMergePolicy(writer));
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+        .setMaxBufferedDocs(10).setMergePolicy(new LogDocMergePolicy()));
 
     for (int i = 0; i < 250; i++) {
       addDoc(writer);
       checkInvariants(writer);
     }
 
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(5);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(5);
 
     // merge policy only fixes segments on levels where merges
     // have been triggered, so check invariants after all adds
@@ -122,9 +124,9 @@ public class TestIndexWriterMergePolicy 
   public void testMaxBufferedDocsChange() throws IOException {
     Directory dir = new RAMDirectory();
 
-    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(101));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(101);
-    writer.setMergePolicy(new LogDocMergePolicy(writer));
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+        .setMaxBufferedDocs(101).setMergePolicy(new LogDocMergePolicy()));
 
     // leftmost* segment has 1 doc
     // rightmost* segment has 100 docs
@@ -135,17 +137,18 @@ public class TestIndexWriterMergePolicy 
       }
       writer.close();
 
-      writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
-          .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(101));
-      ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(101);
-      writer.setMergePolicy(new LogDocMergePolicy(writer));
+      writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT,
+          new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(
+          OpenMode.APPEND).setMaxBufferedDocs(101).setMergePolicy(
+          new LogDocMergePolicy()));
     }
 
     writer.close();
-    writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
-        .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(10));
-    writer.setMergePolicy(new LogDocMergePolicy(writer));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(10);
+    LogDocMergePolicy ldmp = new LogDocMergePolicy();
+    ldmp.setMergeFactor(10);
+    writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT,
+        new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(
+        OpenMode.APPEND).setMaxBufferedDocs(10).setMergePolicy(ldmp));
 
     // merge policy only fixes segments on levels where merges
     // have been triggered, so check invariants after all adds
@@ -169,9 +172,11 @@ public class TestIndexWriterMergePolicy 
   public void testMergeDocCount0() throws IOException {
     Directory dir = new RAMDirectory();
 
-    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(10));
-    writer.setMergePolicy(new LogDocMergePolicy(writer));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(100);
+    LogDocMergePolicy ldmp = new LogDocMergePolicy();
+    ldmp.setMergeFactor(100);
+    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+        .setMaxBufferedDocs(10).setMergePolicy(ldmp));
 
     for (int i = 0; i < 250; i++) {
       addDoc(writer);
@@ -183,10 +188,11 @@ public class TestIndexWriterMergePolicy 
     reader.deleteDocuments(new Term("content", "aaa"));
     reader.close();
 
-    writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
-        .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(10));
-    writer.setMergePolicy(new LogDocMergePolicy(writer));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(5);
+    ldmp = new LogDocMergePolicy();
+    ldmp.setMergeFactor(5);
+    writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT,
+        new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(
+        OpenMode.APPEND).setMaxBufferedDocs(10).setMergePolicy(ldmp));
 
     // merge factor is changed, so check invariants after all adds
     for (int i = 0; i < 10; i++) {
@@ -210,8 +216,8 @@ public class TestIndexWriterMergePolicy 
   private void checkInvariants(IndexWriter writer) throws IOException {
     _TestUtil.syncConcurrentMerges(writer);
     int maxBufferedDocs = writer.getConfig().getMaxBufferedDocs();
-    int mergeFactor = ((LogMergePolicy) writer.getMergePolicy()).getMergeFactor();
-    int maxMergeDocs = ((LogMergePolicy) writer.getMergePolicy()).getMaxMergeDocs();
+    int mergeFactor = ((LogMergePolicy) writer.getConfig().getMergePolicy()).getMergeFactor();
+    int maxMergeDocs = ((LogMergePolicy) writer.getConfig().getMergePolicy()).getMaxMergeDocs();
 
     int ramSegmentCount = writer.getNumBufferedDocuments();
     assertTrue(ramSegmentCount < maxBufferedDocs);

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMerging.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMerging.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMerging.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMerging.java Tue Mar 23 18:52:19 2010
@@ -58,7 +58,7 @@ public class TestIndexWriterMerging exte
     Directory merged = new MockRAMDirectory();
 
     IndexWriter writer = new IndexWriter(merged, new IndexWriterConfig(TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT)));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(2);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2);
 
     writer.addIndexesNoOptimize(new Directory[]{indexA, indexB});
     writer.optimize();
@@ -97,7 +97,7 @@ public class TestIndexWriterMerging exte
         TEST_VERSION_CURRENT, 
         new StandardAnalyzer(TEST_VERSION_CURRENT))
         .setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(2));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(2);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2);
 
     for (int i = start; i < (start + numDocs); i++)
     {

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterReader.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterReader.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterReader.java Tue Mar 23 18:52:19 2010
@@ -476,8 +476,9 @@ public class TestIndexWriterReader exten
   
   public static void createIndex(Directory dir1, String indexName,
       boolean multiSegment) throws IOException {
-    IndexWriter w = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)));
-    w.setMergePolicy(new LogDocMergePolicy(w));
+    IndexWriter w = new IndexWriter(dir1, new IndexWriterConfig(
+        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
+        .setMergePolicy(new LogDocMergePolicy()));
     for (int i = 0; i < 100; i++) {
       w.addDocument(createDocument(i, indexName, 4));
       if (multiSegment && (i % 10) == 0) {
@@ -523,7 +524,7 @@ public class TestIndexWriterReader exten
     // get a reader to put writer into near real-time mode
     IndexReader r1 = writer.getReader();
     
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(2);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2);
 
     for (int i = 0; i < 10; i++) {
       writer.addDocument(createDocument(i, "test", 4));
@@ -607,7 +608,7 @@ public class TestIndexWriterReader exten
     Directory dir1 = new MockRAMDirectory();
     final IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)));
     writer.setInfoStream(infoStream);
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(2);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2);
 
     // create the index
     createIndexNoClose(false, "test", writer);
@@ -684,7 +685,7 @@ public class TestIndexWriterReader exten
     Directory dir1 = new MockRAMDirectory();
     final IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)));
     writer.setInfoStream(infoStream);
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(2);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2);
 
     // create the index
     createIndexNoClose(false, "test", writer);

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestLazyBug.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestLazyBug.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestLazyBug.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestLazyBug.java Tue Mar 23 18:52:19 2010
@@ -73,7 +73,7 @@ public class TestLazyBug extends LuceneT
       Random r = newRandom();
       IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
           TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)));
-      LogMergePolicy lmp = (LogMergePolicy) writer.getMergePolicy();
+      LogMergePolicy lmp = (LogMergePolicy) writer.getConfig().getMergePolicy();
       lmp.setUseCompoundFile(false);
       lmp.setUseCompoundDocStore(false);
       

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestLazyProxSkipping.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestLazyProxSkipping.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestLazyProxSkipping.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestLazyProxSkipping.java Tue Mar 23 18:52:19 2010
@@ -61,8 +61,8 @@ public class TestLazyProxSkipping extend
         
         Directory directory = new SeekCountingDirectory();
         IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(10));
-        ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(false);
-        ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(false);
+        ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false);
+        ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false);
         for (int i = 0; i < numDocs; i++) {
             Document doc = new Document();
             String content;

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestNRTReaderWithThreads.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestNRTReaderWithThreads.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestNRTReaderWithThreads.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestNRTReaderWithThreads.java Tue Mar 23 18:52:19 2010
@@ -33,9 +33,9 @@ public class TestNRTReaderWithThreads ex
   public void testIndexing() throws Exception {
     Directory mainDir = new MockRAMDirectory();
     IndexWriter writer = new IndexWriter(mainDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(10));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(2);
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(false);
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(false);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false);
     IndexReader reader = writer.getReader(); // start pooling readers
     reader.close();
     RunThread[] indexThreads = new RunThread[4];

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestNorms.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestNorms.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestNorms.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestNorms.java Tue Mar 23 18:52:19 2010
@@ -103,7 +103,7 @@ public class TestNorms extends LuceneTes
     IndexWriter iw = new IndexWriter(dir3, new IndexWriterConfig(
         TEST_VERSION_CURRENT, anlzr).setOpenMode(OpenMode.APPEND)
         .setMaxBufferedDocs(5));
-    ((LogMergePolicy) iw.getMergePolicy()).setMergeFactor(3);
+    ((LogMergePolicy) iw.getConfig().getMergePolicy()).setMergeFactor(3);
     iw.addIndexesNoOptimize(new Directory[]{dir1,dir2});
     iw.optimize();
     iw.close();
@@ -121,7 +121,7 @@ public class TestNorms extends LuceneTes
     // now with optimize
     iw = new IndexWriter(dir3, new IndexWriterConfig(TEST_VERSION_CURRENT,
         anlzr).setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(5));
-    ((LogMergePolicy) iw.getMergePolicy()).setMergeFactor(3);
+    ((LogMergePolicy) iw.getConfig().getMergePolicy()).setMergeFactor(3);
     iw.optimize();
     iw.close();
     verifyIndex(dir3);
@@ -148,7 +148,7 @@ public class TestNorms extends LuceneTes
     IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(
         TEST_VERSION_CURRENT, anlzr).setOpenMode(OpenMode.CREATE)
         .setMaxBufferedDocs(5).setSimilarity(similarityOne));
-    LogMergePolicy lmp = (LogMergePolicy) iw.getMergePolicy();
+    LogMergePolicy lmp = (LogMergePolicy) iw.getConfig().getMergePolicy();
     lmp.setMergeFactor(3);
     lmp.setUseCompoundFile(true);
     lmp.setUseCompoundDocStore(true);
@@ -193,7 +193,7 @@ public class TestNorms extends LuceneTes
     IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(
         TEST_VERSION_CURRENT, anlzr).setOpenMode(OpenMode.APPEND)
         .setMaxBufferedDocs(5).setSimilarity(similarityOne));
-    LogMergePolicy lmp = (LogMergePolicy) iw.getMergePolicy();
+    LogMergePolicy lmp = (LogMergePolicy) iw.getConfig().getMergePolicy();
     lmp.setMergeFactor(3);
     lmp.setUseCompoundFile(compound);
     lmp.setUseCompoundDocStore(compound);

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestOmitTf.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestOmitTf.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestOmitTf.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestOmitTf.java Tue Mar 23 18:52:19 2010
@@ -116,7 +116,7 @@ public class TestOmitTf extends LuceneTe
     Analyzer analyzer = new StandardAnalyzer(TEST_VERSION_CURRENT);
     IndexWriter writer = new IndexWriter(ram, new IndexWriterConfig(
         TEST_VERSION_CURRENT, analyzer).setMaxBufferedDocs(3));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(2);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2);
     Document d = new Document();
         
     // this field will have Tf
@@ -173,7 +173,7 @@ public class TestOmitTf extends LuceneTe
     Analyzer analyzer = new StandardAnalyzer(TEST_VERSION_CURRENT);
     IndexWriter writer = new IndexWriter(ram, new IndexWriterConfig(
         TEST_VERSION_CURRENT, analyzer).setMaxBufferedDocs(10));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(2);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2);
     Document d = new Document();
         
     // this field will have Tf
@@ -221,7 +221,7 @@ public class TestOmitTf extends LuceneTe
     Analyzer analyzer = new StandardAnalyzer(TEST_VERSION_CURRENT);
     IndexWriter writer = new IndexWriter(ram, new IndexWriterConfig(
         TEST_VERSION_CURRENT, analyzer).setMaxBufferedDocs(3));
-    LogMergePolicy lmp = (LogMergePolicy) writer.getMergePolicy();
+    LogMergePolicy lmp = (LogMergePolicy) writer.getConfig().getMergePolicy();
     lmp.setMergeFactor(2);
     lmp.setUseCompoundFile(false);
     lmp.setUseCompoundDocStore(false);
@@ -255,8 +255,7 @@ public class TestOmitTf extends LuceneTe
     IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
         TEST_VERSION_CURRENT, analyzer).setMaxBufferedDocs(2)
         .setSimilarity(new SimpleSimilarity()));
-    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(2);
-        
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2);
         
     StringBuilder sb = new StringBuilder(265);
     String term = "term";

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestStressIndexing2.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestStressIndexing2.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestStressIndexing2.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestStressIndexing2.java Tue Mar 23 18:52:19 2010
@@ -148,7 +148,7 @@ public class TestStressIndexing2 extends
     IndexWriter w = new MockIndexWriter(dir, new IndexWriterConfig(
         TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE).setRAMBufferSizeMB(
         0.1).setMaxBufferedDocs(maxBufferedDocs));
-    LogMergePolicy lmp = (LogMergePolicy) w.getMergePolicy();
+    LogMergePolicy lmp = (LogMergePolicy) w.getConfig().getMergePolicy();
     lmp.setUseCompoundFile(false);
     lmp.setUseCompoundDocStore(false);
     lmp.setMergeFactor(mergeFactor);
@@ -199,7 +199,7 @@ public class TestStressIndexing2 extends
       IndexWriter w = new MockIndexWriter(dir, new IndexWriterConfig(
           TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE)
                .setRAMBufferSizeMB(0.1).setMaxBufferedDocs(maxBufferedDocs).setMaxThreadStates(maxThreadStates));
-      LogMergePolicy lmp = (LogMergePolicy) w.getMergePolicy();
+      LogMergePolicy lmp = (LogMergePolicy) w.getConfig().getMergePolicy();
       lmp.setUseCompoundFile(false);
       lmp.setUseCompoundDocStore(false);
       lmp.setMergeFactor(mergeFactor);

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestTermVectorsReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestTermVectorsReader.java?rev=926725&r1=926724&r2=926725&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestTermVectorsReader.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestTermVectorsReader.java Tue Mar 23 18:52:19 2010
@@ -93,8 +93,8 @@ public class TestTermVectorsReader exten
     Arrays.sort(tokens);
 
     IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MyAnalyzer()));
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(false);
-    ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(false);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false);
+    ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false);
     Document doc = new Document();
     for(int i=0;i<testFields.length;i++) {
       final Field.TermVector tv;



Mime
View raw message