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 [2/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/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java (original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/BooleanFilterTest.java Wed Mar 10 17:53:46 2010
@@ -19,11 +19,11 @@ package org.apache.lucene.search;
 
 import java.io.IOException;
 
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.util.LuceneTestCase;
@@ -36,7 +36,7 @@ public class BooleanFilterTest extends L
 	protected void setUp() throws Exception {
 	  super.setUp();
 		directory = new RAMDirectory();
-		IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+		IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT));
 		
 		//Add series of docs with filterable fields : acces rights, prices, dates and "in-stock" flags
 		addDoc(writer, "admin guest", "010", "20040101","Y");

Modified: lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java (original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java Wed Mar 10 17:53:46 2010
@@ -25,6 +25,7 @@ import org.apache.lucene.document.Docume
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermDocs;
 import org.apache.lucene.store.RAMDirectory;
@@ -41,7 +42,7 @@ public class DuplicateFilterTest extends
 	protected void setUp() throws Exception {
     super.setUp();
 		directory = new RAMDirectory();
-		IndexWriter writer = new IndexWriter(directory, new StandardAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+		IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT).setAnalyzer(new StandardAnalyzer(TEST_VERSION_CURRENT)));
 		
 		//Add series of docs with filterable fields : url, text and dates  flags
 		addDoc(writer, "http://lucene.apache.org", "lucene 1.4.3 available", "20040101");

Modified: lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java (original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java Wed Mar 10 17:53:46 2010
@@ -25,8 +25,8 @@ import org.apache.lucene.analysis.Whites
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.index.IndexWriter.MaxFieldLength;
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.util.LuceneTestCase;
 
@@ -39,7 +39,8 @@ public class FuzzyLikeThisQueryTest exte
 	protected void setUp() throws Exception	{
 	  super.setUp();
 		directory = new RAMDirectory();
-		IndexWriter writer = new IndexWriter(directory, analyzer,true, MaxFieldLength.UNLIMITED);
+		IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(
+        TEST_VERSION_CURRENT).setAnalyzer(analyzer));
 		
 		//Add series of docs with misspelt names
 		addDoc(writer, "jonathon smythe","1");

Modified: lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/TermsFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/TermsFilterTest.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/TermsFilterTest.java (original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/TermsFilterTest.java Wed Mar 10 17:53:46 2010
@@ -19,13 +19,12 @@ package org.apache.lucene.search;
 
 import java.util.HashSet;
 
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.index.IndexWriter.MaxFieldLength;
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.OpenBitSet;
@@ -54,9 +53,8 @@ public class TermsFilterTest extends Luc
 	{
 		String fieldName="field1";
 		RAMDirectory rd=new RAMDirectory();
-		IndexWriter w=new IndexWriter(rd,new WhitespaceAnalyzer(TEST_VERSION_CURRENT),MaxFieldLength.UNLIMITED);
-		for (int i = 0; i < 100; i++)
-		{
+		IndexWriter w = new IndexWriter(rd, new IndexWriterConfig(TEST_VERSION_CURRENT));
+		for (int i = 0; i < 100; i++) {
 			Document doc=new Document();
 			int term=i*10; //terms are units of 10;
 			doc.add(new Field(fieldName,""+term,Field.Store.YES,Field.Index.NOT_ANALYZED));

Modified: lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java (original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java Wed Mar 10 17:53:46 2010
@@ -28,7 +28,7 @@ import org.apache.lucene.document.Docume
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.IndexWriter.MaxFieldLength;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.search.BooleanClause;
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.IndexSearcher;
@@ -45,8 +45,7 @@ public class TestMoreLikeThis extends Lu
     protected void setUp() throws Exception {
       super.setUp();
 	directory = new RAMDirectory();
-	IndexWriter writer = new IndexWriter(directory, new StandardAnalyzer(TEST_VERSION_CURRENT),
-		true, MaxFieldLength.UNLIMITED);
+	IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT).setAnalyzer(new StandardAnalyzer(TEST_VERSION_CURRENT)));
 
 	// Add series of docs with specific information for MoreLikeThis
 	addDoc(writer, "lucene");

Modified: lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java Wed Mar 10 17:53:46 2010
@@ -27,6 +27,7 @@ import org.apache.lucene.analysis.standa
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.queryParser.core.QueryNodeException;
 import org.apache.lucene.queryParser.standard.config.DefaultOperatorAttribute.Operator;
 import org.apache.lucene.search.BooleanClause;
@@ -319,8 +320,7 @@ public class TestMultiFieldQPHelper exte
   public void testStopWordSearching() throws Exception {
     Analyzer analyzer = new StandardAnalyzer(TEST_VERSION_CURRENT);
     Directory ramDir = new RAMDirectory();
-    IndexWriter iw = new IndexWriter(ramDir, analyzer, true,
-        IndexWriter.MaxFieldLength.LIMITED);
+    IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT).setAnalyzer(analyzer));
     Document doc = new Document();
     doc.add(new Field("body", "blah the footest blah", Field.Store.NO,
         Field.Index.ANALYZED));

Modified: lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java Wed Mar 10 17:53:46 2010
@@ -40,7 +40,11 @@ import org.apache.lucene.store.RAMDirect
 import org.apache.lucene.util.LuceneTestCase;
 
 /**
- * Tests multi field query parsing using the {@link MultiFieldQueryParserWrapper}.
+ * Tests multi field query parsing using the
+ * {@link MultiFieldQueryParserWrapper}.
+ * 
+ * @deprecated this tests test the deprecated MultiFieldQueryParserWrapper, so
+ *             when the latter is gone, so should this test.
  */
 public class TestMultiFieldQueryParserWrapper extends LuceneTestCase {
 

Modified: lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java Wed Mar 10 17:53:46 2010
@@ -51,6 +51,7 @@ import org.apache.lucene.document.Docume
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.messages.MessageImpl;
 import org.apache.lucene.queryParser.core.QueryNodeException;
@@ -571,8 +572,7 @@ public class TestQPHelper extends Locali
   public void testFarsiRangeCollating() throws Exception {
 
     RAMDirectory ramDir = new RAMDirectory();
-    IndexWriter iw = new IndexWriter(ramDir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
-        IndexWriter.MaxFieldLength.LIMITED);
+    IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT));
     Document doc = new Document();
     doc.add(new Field("content", "\u0633\u0627\u0628", Field.Store.YES,
         Field.Index.NOT_ANALYZED));
@@ -994,8 +994,7 @@ public class TestQPHelper extends Locali
   public void testLocalDateFormat() throws IOException, QueryNodeException {
 
     RAMDirectory ramDir = new RAMDirectory();
-    IndexWriter iw = new IndexWriter(ramDir, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true,
-        IndexWriter.MaxFieldLength.LIMITED);
+    IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT));
     addDateDoc("a", 2005, 12, 2, 10, 15, 33, iw);
     addDateDoc("b", 2005, 12, 4, 22, 15, 00, iw);
     iw.close();
@@ -1193,7 +1192,7 @@ public class TestQPHelper extends Locali
 
   public void testMultiPhraseQuery() throws Exception {
     MockRAMDirectory dir = new MockRAMDirectory();
-    IndexWriter w = new IndexWriter(dir, new CannedAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED);
+    IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT).setAnalyzer(new CannedAnalyzer()));
     Document doc = new Document();
     doc.add(new Field("field", "", Field.Store.NO, Field.Index.ANALYZED));
     w.addDocument(doc);

Modified: lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java (original)
+++ lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java Wed Mar 10 17:53:46 2010
@@ -78,6 +78,9 @@ import org.apache.lucene.util.LocalizedT
  * to use new {@link QueryParserWrapper} instead of the old query parser.
  * 
  * Tests QueryParser.
+ * 
+ * @deprecated this entire test case tests QueryParserWrapper which is
+ *             deprecated. When QPW is gone, so will the test.
  */
 public class TestQueryParserWrapper extends LocalizedTestCase {
 

Modified: lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestRegexQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestRegexQuery.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestRegexQuery.java (original)
+++ lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestRegexQuery.java Wed Mar 10 17:53:46 2010
@@ -19,8 +19,8 @@ package org.apache.lucene.search.regex;
 
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.analysis.SimpleAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.search.IndexSearcher;
@@ -40,8 +40,7 @@ public class TestRegexQuery extends Luce
     super.setUp();
     RAMDirectory directory = new RAMDirectory();
     try {
-      IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(TEST_VERSION_CURRENT), true, 
-                                           IndexWriter.MaxFieldLength.LIMITED);
+      IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT));
       Document doc = new Document();
       doc.add(new Field(FN, "the quick brown fox jumps over the lazy dog", Field.Store.NO, Field.Index.ANALYZED));
       writer.addDocument(doc);

Modified: lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestSpanRegexQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestSpanRegexQuery.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestSpanRegexQuery.java (original)
+++ lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestSpanRegexQuery.java Wed Mar 10 17:53:46 2010
@@ -19,13 +19,13 @@ package org.apache.lucene.search.regex;
 
 import java.io.IOException;
 
-import org.apache.lucene.analysis.SimpleAnalyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.CorruptIndexException;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.Term;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.MultiSearcher;
 import org.apache.lucene.search.spans.SpanFirstQuery;
@@ -44,7 +44,7 @@ public class TestSpanRegexQuery extends 
 
   public void testSpanRegex() throws Exception {
     RAMDirectory directory = new RAMDirectory();
-    IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+    IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT));
     Document doc = new Document();
     // doc.add(new Field("field", "the quick brown fox jumps over the lazy dog",
     // Field.Store.NO, Field.Index.ANALYZED));
@@ -109,15 +109,15 @@ public class TestSpanRegexQuery extends 
         Field.Index.ANALYZED_NO_NORMS));
 
     // creating first index writer
-    IndexWriter writerA = new IndexWriter(indexStoreA, new StandardAnalyzer(TEST_VERSION_CURRENT),
-        true, IndexWriter.MaxFieldLength.LIMITED);
+    IndexWriter writerA = new IndexWriter(indexStoreA, new IndexWriterConfig(
+        TEST_VERSION_CURRENT).setOpenMode(OpenMode.CREATE));
     writerA.addDocument(lDoc);
     writerA.optimize();
     writerA.close();
 
     // creating second index writer
-    IndexWriter writerB = new IndexWriter(indexStoreB, new StandardAnalyzer(TEST_VERSION_CURRENT),
-        true, IndexWriter.MaxFieldLength.LIMITED);
+    IndexWriter writerB = new IndexWriter(indexStoreB, new IndexWriterConfig(
+        TEST_VERSION_CURRENT).setOpenMode(OpenMode.CREATE));
     writerB.addDocument(lDoc2);
     writerB.optimize();
     writerB.close();

Modified: lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java (original)
+++ lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java Wed Mar 10 17:53:46 2010
@@ -27,6 +27,7 @@ import org.apache.lucene.analysis.Simple
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.RAMDirectory;
 
@@ -57,8 +58,9 @@ public class TestRemoteCachingWrapperFil
   private static void startServer() throws Exception {
     // construct an index
     RAMDirectory indexStore = new RAMDirectory();
-    IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(TEST_VERSION_CURRENT), true,
-                                         IndexWriter.MaxFieldLength.LIMITED);
+    IndexWriter writer = new IndexWriter(indexStore, new IndexWriterConfig(
+        TEST_VERSION_CURRENT).setAnalyzer(new SimpleAnalyzer(
+        TEST_VERSION_CURRENT)));
     Document doc = new Document();
     doc.add(new Field("test", "test text", Field.Store.YES, Field.Index.ANALYZED));
     doc.add(new Field("type", "A", Field.Store.YES, Field.Index.ANALYZED));

Modified: lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSearchable.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSearchable.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSearchable.java (original)
+++ lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSearchable.java Wed Mar 10 17:53:46 2010
@@ -19,9 +19,9 @@ package org.apache.lucene.search;
 
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util._TestUtil;
-import org.apache.lucene.analysis.SimpleAnalyzer;
 import org.apache.lucene.document.*;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.RAMDirectory;
 
@@ -58,7 +58,7 @@ public class TestRemoteSearchable extend
   private static void startServer() throws Exception {
     // construct an index
     RAMDirectory indexStore = new RAMDirectory();
-    IndexWriter writer = new IndexWriter(indexStore,new SimpleAnalyzer(TEST_VERSION_CURRENT),true, IndexWriter.MaxFieldLength.LIMITED);
+    IndexWriter writer = new IndexWriter(indexStore,new IndexWriterConfig(TEST_VERSION_CURRENT));
     Document doc = new Document();
     doc.add(new Field("test", "test text", Field.Store.YES, Field.Index.ANALYZED));
     doc.add(new Field("other", "other test text", Field.Store.YES, Field.Index.ANALYZED));

Modified: lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java (original)
+++ lucene/java/trunk/contrib/remote/src/test/org/apache/lucene/search/TestRemoteSort.java Wed Mar 10 17:53:46 2010
@@ -30,11 +30,12 @@ import junit.framework.Test;
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
 
-import org.apache.lucene.analysis.SimpleAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.LogMergePolicy;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.util.LuceneTestCase;
@@ -109,9 +110,9 @@ public class TestRemoteSort extends Luce
   private Searcher getIndex (boolean even, boolean odd)
   throws IOException {
     RAMDirectory indexStore = new RAMDirectory ();
-    IndexWriter writer = new IndexWriter (indexStore, new SimpleAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.LIMITED);
-    writer.setMaxBufferedDocs(2);
-    writer.setMergeFactor(1000);
+    IndexWriter writer = new IndexWriter(indexStore, new IndexWriterConfig(
+        TEST_VERSION_CURRENT).setMaxBufferedDocs(2));
+    ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(1000);
     for (int i=0; i<data.length; ++i) {
       if (((i%2)==0 && even) || ((i%2)==1 && odd)) {
         Document doc = new Document();

Modified: lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java (original)
+++ lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java Wed Mar 10 17:53:46 2010
@@ -21,11 +21,11 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
@@ -71,7 +71,7 @@ public class TestCartesian extends Lucen
     super.setUp();
     directory = new RAMDirectory();
 
-    IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+    IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT));
     
     setUpPlotter( 2, 15);
     

Modified: lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java (original)
+++ lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java Wed Mar 10 17:53:46 2010
@@ -18,10 +18,10 @@ package org.apache.lucene.spatial.tier;
 
 import java.io.IOException;
 
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.QueryWrapperFilter;
@@ -44,7 +44,7 @@ public class TestDistance extends Lucene
   protected void setUp() throws Exception {
     super.setUp();
     directory = new RAMDirectory();
-    writer = new IndexWriter(directory, new WhitespaceAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+    writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT));
     addData(writer);
     
   }

Modified: lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java (original)
+++ lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java Wed Mar 10 17:53:46 2010
@@ -20,12 +20,14 @@ package org.apache.lucene.search.spell;
 import java.io.IOException;
 import java.util.Iterator;
 
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.LogMergePolicy;
 import org.apache.lucene.index.Term;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.search.BooleanClause;
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.IndexSearcher;
@@ -34,6 +36,7 @@ import org.apache.lucene.search.ScoreDoc
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.store.AlreadyClosedException;
 import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.Version;
 
 /**
  * <p>
@@ -139,8 +142,7 @@ public class SpellChecker implements jav
     synchronized (modifyCurrentIndexLock) {
       ensureOpen();
       if (!IndexReader.indexExists(spellIndexDir)) {
-          IndexWriter writer = new IndexWriter(spellIndexDir, null, true,
-              IndexWriter.MaxFieldLength.UNLIMITED);
+          IndexWriter writer = new IndexWriter(spellIndexDir, new IndexWriterConfig(Version.LUCENE_CURRENT));
           writer.close();
       }
       swapSearcher(spellIndexDir);
@@ -353,7 +355,8 @@ public class SpellChecker implements jav
     synchronized (modifyCurrentIndexLock) {
       ensureOpen();
       final Directory dir = this.spellIndex;
-      final IndexWriter writer = new IndexWriter(dir, null, true, IndexWriter.MaxFieldLength.UNLIMITED);
+      final IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+          Version.LUCENE_CURRENT).setOpenMode(OpenMode.CREATE));
       writer.close();
       swapSearcher(dir);
     }
@@ -388,10 +391,8 @@ public class SpellChecker implements jav
     synchronized (modifyCurrentIndexLock) {
       ensureOpen();
       final Directory dir = this.spellIndex;
-      final IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(),
-          IndexWriter.MaxFieldLength.UNLIMITED);
-      writer.setMergeFactor(mergeFactor);
-      writer.setRAMBufferSizeMB(ramMB);
+      final IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(Version.LUCENE_CURRENT).setRAMBufferSizeMB(ramMB));
+      ((LogMergePolicy) writer.getMergePolicy()).setMergeFactor(mergeFactor);
   
       Iterator<String> iter = dict.getWordsIterator();
       while (iter.hasNext()) {

Modified: lucene/java/trunk/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java (original)
+++ lucene/java/trunk/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java Wed Mar 10 17:53:46 2010
@@ -20,11 +20,11 @@ package org.apache.lucene.search.spell;
 import java.io.IOException;
 import java.util.Iterator;
 
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.util.LuceneTestCase;
@@ -46,7 +46,7 @@ public class TestLuceneDictionary extend
   @Override
   protected void setUp() throws Exception {
     super.setUp();
-    IndexWriter writer = new IndexWriter(store, new WhitespaceAnalyzer(LuceneTestCase.TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+    IndexWriter writer = new IndexWriter(store, new IndexWriterConfig(TEST_VERSION_CURRENT));
 
     Document doc;
 

Modified: lucene/java/trunk/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestSpellChecker.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestSpellChecker.java (original)
+++ lucene/java/trunk/contrib/spellchecker/src/test/org/apache/lucene/search/spell/TestSpellChecker.java Wed Mar 10 17:53:46 2010
@@ -26,12 +26,12 @@ import java.util.concurrent.ExecutorServ
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.lucene.analysis.SimpleAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.CorruptIndexException;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.store.AlreadyClosedException;
 import org.apache.lucene.store.Directory;
@@ -54,7 +54,7 @@ public class TestSpellChecker extends Lu
     
     //create a user index
     userindex = new RAMDirectory();
-    IndexWriter writer = new IndexWriter(userindex, new SimpleAnalyzer(TEST_VERSION_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
+    IndexWriter writer = new IndexWriter(userindex, new IndexWriterConfig(TEST_VERSION_CURRENT));
 
     for (int i = 0; i < 1000; i++) {
       Document doc = new Document();

Modified: lucene/java/trunk/contrib/surround/src/test/org/apache/lucene/queryParser/surround/query/SingleFieldTestDb.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/surround/src/test/org/apache/lucene/queryParser/surround/query/SingleFieldTestDb.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/surround/src/test/org/apache/lucene/queryParser/surround/query/SingleFieldTestDb.java (original)
+++ lucene/java/trunk/contrib/surround/src/test/org/apache/lucene/queryParser/surround/query/SingleFieldTestDb.java Wed Mar 10 17:53:46 2010
@@ -19,11 +19,11 @@ package org.apache.lucene.queryParser.su
 
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.Version;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
-import org.apache.lucene.analysis.WhitespaceAnalyzer;
-import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 
 public class SingleFieldTestDb {
   private Directory db;
@@ -35,9 +35,7 @@ public class SingleFieldTestDb {
       db = new RAMDirectory();
       docs = documents;
       fieldName = fName;
-      Analyzer analyzer = new WhitespaceAnalyzer();
-      IndexWriter writer = new IndexWriter(db, analyzer, true, 
-                                           IndexWriter.MaxFieldLength.LIMITED);
+      IndexWriter writer = new IndexWriter(db, new IndexWriterConfig(Version.LUCENE_CURRENT));
       for (int j = 0; j < docs.length; j++) {
         Document d = new Document();
         d.add(new Field(fieldName, docs[j], Field.Store.NO, Field.Index.ANALYZED));

Modified: lucene/java/trunk/contrib/swing/src/java/org/apache/lucene/swing/models/ListSearcher.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/swing/src/java/org/apache/lucene/swing/models/ListSearcher.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/swing/src/java/org/apache/lucene/swing/models/ListSearcher.java (original)
+++ lucene/java/trunk/contrib/swing/src/java/org/apache/lucene/swing/models/ListSearcher.java Wed Mar 10 17:53:46 2010
@@ -31,6 +31,7 @@ import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.queryParser.MultiFieldQueryParser;
 import org.apache.lucene.search.Collector;
 import org.apache.lucene.search.IndexSearcher;
@@ -87,7 +88,7 @@ public class ListSearcher extends Abstra
     private ListDataListener listModelListener;
 
     public ListSearcher(ListModel newModel) {
-        analyzer = new WhitespaceAnalyzer();
+        analyzer = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
         setListModel(newModel);
         listModelListener = new ListModelHandler();
         newModel.addListDataListener(listModelListener);
@@ -117,7 +118,7 @@ public class ListSearcher extends Abstra
         try {
             // recreate the RAMDirectory
             directory = new RAMDirectory();
-            IndexWriter writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
+            IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(Version.LUCENE_CURRENT).setAnalyzer(analyzer));
 
             // iterate through all rows
             for (int row=0; row < listModel.getSize(); row++){

Modified: lucene/java/trunk/contrib/swing/src/java/org/apache/lucene/swing/models/TableSearcher.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/swing/src/java/org/apache/lucene/swing/models/TableSearcher.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/swing/src/java/org/apache/lucene/swing/models/TableSearcher.java (original)
+++ lucene/java/trunk/contrib/swing/src/java/org/apache/lucene/swing/models/TableSearcher.java Wed Mar 10 17:53:46 2010
@@ -29,6 +29,7 @@ import org.apache.lucene.document.Docume
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.queryParser.MultiFieldQueryParser;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
@@ -115,7 +116,7 @@ public class TableSearcher extends Abstr
      * @param tableModel The table model to decorate
      */
     public TableSearcher(TableModel tableModel) {
-        analyzer = new WhitespaceAnalyzer();
+        analyzer = new WhitespaceAnalyzer(Version.LUCENE_CURRENT);
         tableModelListener = new TableModelHandler();
         setTableModel(tableModel);
         tableModel.addTableModelListener(tableModelListener);
@@ -163,7 +164,7 @@ public class TableSearcher extends Abstr
         try {
             // recreate the RAMDirectory
             directory = new RAMDirectory();
-            IndexWriter writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);
+            IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(Version.LUCENE_CURRENT).setAnalyzer(analyzer));
 
             // iterate through all rows
             for (int row=0; row < tableModel.getRowCount(); row++){

Modified: lucene/java/trunk/contrib/wordnet/src/java/org/apache/lucene/wordnet/Syns2Index.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/wordnet/src/java/org/apache/lucene/wordnet/Syns2Index.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/wordnet/src/java/org/apache/lucene/wordnet/Syns2Index.java (original)
+++ lucene/java/trunk/contrib/wordnet/src/java/org/apache/lucene/wordnet/Syns2Index.java Wed Mar 10 17:53:46 2010
@@ -35,6 +35,9 @@ import org.apache.lucene.analysis.standa
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.LogMergePolicy;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.util.Version;
 
@@ -245,8 +248,10 @@ public class Syns2Index
         try {
 
           // override the specific index if it already exists
-          IndexWriter writer = new IndexWriter(dir, ana, true, IndexWriter.MaxFieldLength.LIMITED);
-          writer.setUseCompoundFile(true); // why?
+          IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
+              Version.LUCENE_CURRENT).setOpenMode(OpenMode.CREATE).setAnalyzer(ana));
+          ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundFile(true); // why?
+          ((LogMergePolicy) writer.getMergePolicy()).setUseCompoundDocStore(true); // why?
           Iterator<String> i1 = word2Nums.keySet().iterator();
           while (i1.hasNext()) // for each word
           {

Modified: lucene/java/trunk/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java Wed Mar 10 17:53:46 2010
@@ -12,12 +12,14 @@ import org.apache.lucene.analysis.standa
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.Version;
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -63,7 +65,7 @@ public class TestParser extends TestCase
 		{
 			BufferedReader d = new BufferedReader(new InputStreamReader(TestParser.class.getResourceAsStream("reuters21578.txt"))); 
 			dir=new RAMDirectory();
-			IndexWriter writer=new IndexWriter(dir,analyzer,true, IndexWriter.MaxFieldLength.UNLIMITED);
+			IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(Version.LUCENE_24).setAnalyzer(analyzer));
 			String line = d.readLine();		
 			while(line!=null)
 			{

Modified: lucene/java/trunk/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestQueryTemplateManager.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestQueryTemplateManager.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestQueryTemplateManager.java (original)
+++ lucene/java/trunk/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestQueryTemplateManager.java Wed Mar 10 17:53:46 2010
@@ -11,6 +11,7 @@ import org.apache.lucene.analysis.Analyz
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.store.RAMDirectory;
@@ -141,7 +142,7 @@ public class TestQueryTemplateManager ex
 		
 		//Create an index
 		RAMDirectory dir=new RAMDirectory();
-		IndexWriter w=new IndexWriter(dir,analyzer,true, IndexWriter.MaxFieldLength.UNLIMITED);
+		IndexWriter w=new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT).setAnalyzer(analyzer));
 		for (int i = 0; i < docFieldValues.length; i++)
 		{
 			w.addDocument(getDocumentFromString(docFieldValues[i]));

Modified: lucene/java/trunk/src/demo/org/apache/lucene/demo/IndexFiles.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/demo/org/apache/lucene/demo/IndexFiles.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/src/demo/org/apache/lucene/demo/IndexFiles.java (original)
+++ lucene/java/trunk/src/demo/org/apache/lucene/demo/IndexFiles.java Wed Mar 10 17:53:46 2010
@@ -19,6 +19,8 @@ package org.apache.lucene.demo;
 
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.util.Version;
 
@@ -55,7 +57,10 @@ public class IndexFiles {
     
     Date start = new Date();
     try {
-      IndexWriter writer = new IndexWriter(FSDirectory.open(INDEX_DIR), new StandardAnalyzer(Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.LIMITED);
+      IndexWriter writer = new IndexWriter(FSDirectory.open(INDEX_DIR),
+          new IndexWriterConfig(Version.LUCENE_CURRENT).setOpenMode(
+              OpenMode.CREATE).setAnalyzer(
+              new StandardAnalyzer(Version.LUCENE_CURRENT)));
       System.out.println("Indexing to directory '" +INDEX_DIR+ "'...");
       indexDocs(writer, docDir);
       System.out.println("Optimizing...");

Modified: lucene/java/trunk/src/demo/org/apache/lucene/demo/IndexHTML.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/demo/org/apache/lucene/demo/IndexHTML.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/src/demo/org/apache/lucene/demo/IndexHTML.java (original)
+++ lucene/java/trunk/src/demo/org/apache/lucene/demo/IndexHTML.java Wed Mar 10 17:53:46 2010
@@ -21,8 +21,10 @@ import org.apache.lucene.analysis.standa
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermEnum;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.util.Version;
 
@@ -77,8 +79,9 @@ public class IndexHTML {
         deleting = true;
         indexDocs(root, index, create);
       }
-      writer = new IndexWriter(FSDirectory.open(index), new StandardAnalyzer(Version.LUCENE_CURRENT), create, 
-                               new IndexWriter.MaxFieldLength(1000000));
+      writer = new IndexWriter(FSDirectory.open(index), new IndexWriterConfig(
+          Version.LUCENE_CURRENT).setAnalyzer(new StandardAnalyzer(
+          Version.LUCENE_CURRENT)).setMaxFieldLength(1000000).setOpenMode(create ? OpenMode.CREATE : OpenMode.CREATE_OR_APPEND));
       indexDocs(root, index, create);		  // add new docs
 
       System.out.println("Optimizing index...");

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/DirectoryReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/DirectoryReader.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/DirectoryReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/DirectoryReader.java Wed Mar 10 17:53:46 2010
@@ -742,7 +742,7 @@ class DirectoryReader extends IndexReade
 
       if (writeLock == null) {
         Lock writeLock = directory.makeLock(IndexWriter.WRITE_LOCK_NAME);
-        if (!writeLock.obtain(IndexWriter.WRITE_LOCK_TIMEOUT)) // obtain write lock
+        if (!writeLock.obtain(IndexWriterConfig.WRITE_LOCK_TIMEOUT)) // obtain write lock
           throw new LockObtainFailedException("Index locked for write: " + writeLock);
         this.writeLock = writeLock;
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/DocumentsWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/DocumentsWriter.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/DocumentsWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/DocumentsWriter.java Wed Mar 10 17:53:46 2010
@@ -138,7 +138,7 @@ final class DocumentsWriter {
   private DocFieldProcessor docFieldProcessor;
 
   PrintStream infoStream;
-  int maxFieldLength = IndexWriter.DEFAULT_MAX_FIELD_LENGTH;
+  int maxFieldLength = IndexWriterConfig.UNLIMITED_FIELD_LENGTH;
   Similarity similarity;
 
   List<String> newFiles;
@@ -223,7 +223,7 @@ final class DocumentsWriter {
     abstract DocConsumer getChain(DocumentsWriter documentsWriter);
   }
   
-  static final IndexingChain DefaultIndexingChain = new IndexingChain() {
+  static final IndexingChain defaultIndexingChain = new IndexingChain() {
 
     @Override
     DocConsumer getChain(DocumentsWriter documentsWriter) {
@@ -270,22 +270,22 @@ final class DocumentsWriter {
 
   // The max number of delete terms that can be buffered before
   // they must be flushed to disk.
-  private int maxBufferedDeleteTerms = IndexWriter.DEFAULT_MAX_BUFFERED_DELETE_TERMS;
+  private int maxBufferedDeleteTerms = IndexWriterConfig.DEFAULT_MAX_BUFFERED_DELETE_TERMS;
 
   // How much RAM we can use before flushing.  This is 0 if
   // we are flushing by doc count instead.
-  private long ramBufferSize = (long) (IndexWriter.DEFAULT_RAM_BUFFER_SIZE_MB*1024*1024);
+  private long ramBufferSize = (long) (IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB*1024*1024);
   private long waitQueuePauseBytes = (long) (ramBufferSize*0.1);
   private long waitQueueResumeBytes = (long) (ramBufferSize*0.05);
 
   // If we've allocated 5% over our RAM budget, we then
   // free down to 95%
-  private long freeTrigger = (long) (IndexWriter.DEFAULT_RAM_BUFFER_SIZE_MB*1024*1024*1.05);
-  private long freeLevel = (long) (IndexWriter.DEFAULT_RAM_BUFFER_SIZE_MB*1024*1024*0.95);
+  private long freeTrigger = (long) (IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB*1024*1024*1.05);
+  private long freeLevel = (long) (IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB*1024*1024*0.95);
 
   // Flush @ this number of docs.  If ramBufferSize is
   // non-zero we will flush by RAM usage instead.
-  private int maxBufferedDocs = IndexWriter.DEFAULT_MAX_BUFFERED_DOCS;
+  private int maxBufferedDocs = IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS;
 
   private int flushedDocCount;                      // How many docs already flushed to index
 
@@ -304,7 +304,7 @@ final class DocumentsWriter {
   DocumentsWriter(Directory directory, IndexWriter writer, IndexingChain indexingChain) throws IOException {
     this.directory = directory;
     this.writer = writer;
-    this.similarity = writer.getSimilarity();
+    this.similarity = writer.getConfig().getSimilarity();
     flushedDocCount = writer.maxDoc();
 
     consumer = indexingChain.getChain(this);
@@ -342,8 +342,8 @@ final class DocumentsWriter {
 
   /** Set how much RAM we can use before flushing. */
   synchronized void setRAMBufferSizeMB(double mb) {
-    if (mb == IndexWriter.DISABLE_AUTO_FLUSH) {
-      ramBufferSize = IndexWriter.DISABLE_AUTO_FLUSH;
+    if (mb == IndexWriterConfig.DISABLE_AUTO_FLUSH) {
+      ramBufferSize = IndexWriterConfig.DISABLE_AUTO_FLUSH;
       waitQueuePauseBytes = 4*1024*1024;
       waitQueueResumeBytes = 2*1024*1024;
     } else {
@@ -356,7 +356,7 @@ final class DocumentsWriter {
   }
 
   synchronized double getRAMBufferSizeMB() {
-    if (ramBufferSize == IndexWriter.DISABLE_AUTO_FLUSH) {
+    if (ramBufferSize == IndexWriterConfig.DISABLE_AUTO_FLUSH) {
       return ramBufferSize;
     } else {
       return ramBufferSize/1024./1024.;
@@ -587,7 +587,7 @@ final class DocumentsWriter {
 
   synchronized private void initFlushState(boolean onlyDocStore) {
     initSegmentName(onlyDocStore);
-    flushState = new SegmentWriteState(this, directory, segment, docStoreSegment, numDocsInRAM, numDocsInStore, writer.getTermIndexInterval());
+    flushState = new SegmentWriteState(this, directory, segment, docStoreSegment, numDocsInRAM, numDocsInStore, writer.getConfig().getTermIndexInterval());
   }
 
   /** Flush all pending docs to a new segment */
@@ -766,7 +766,7 @@ final class DocumentsWriter {
       // always get N docs when we flush by doc count, even if
       // > 1 thread is adding documents:
       if (!flushPending &&
-          maxBufferedDocs != IndexWriter.DISABLE_AUTO_FLUSH
+          maxBufferedDocs != IndexWriterConfig.DISABLE_AUTO_FLUSH
           && numDocsInRAM >= maxBufferedDocs) {
         flushPending = true;
         state.doFlushAfter = true;
@@ -928,9 +928,9 @@ final class DocumentsWriter {
   }
 
   synchronized boolean deletesFull() {
-    return (ramBufferSize != IndexWriter.DISABLE_AUTO_FLUSH &&
+    return (ramBufferSize != IndexWriterConfig.DISABLE_AUTO_FLUSH &&
             (deletesInRAM.bytesUsed + deletesFlushed.bytesUsed + numBytesUsed) >= ramBufferSize) ||
-      (maxBufferedDeleteTerms != IndexWriter.DISABLE_AUTO_FLUSH &&
+      (maxBufferedDeleteTerms != IndexWriterConfig.DISABLE_AUTO_FLUSH &&
        ((deletesInRAM.size() + deletesFlushed.size()) >= maxBufferedDeleteTerms));
   }
 
@@ -943,9 +943,9 @@ final class DocumentsWriter {
     // too-frequent flushing of a long tail of tiny segments
     // when merges (which always apply deletes) are
     // infrequent.
-    return (ramBufferSize != IndexWriter.DISABLE_AUTO_FLUSH &&
+    return (ramBufferSize != IndexWriterConfig.DISABLE_AUTO_FLUSH &&
             (deletesInRAM.bytesUsed + deletesFlushed.bytesUsed) >= ramBufferSize/2) ||
-      (maxBufferedDeleteTerms != IndexWriter.DISABLE_AUTO_FLUSH &&
+      (maxBufferedDeleteTerms != IndexWriterConfig.DISABLE_AUTO_FLUSH &&
        ((deletesInRAM.size() + deletesFlushed.size()) >= maxBufferedDeleteTerms));
   }
 
@@ -1115,7 +1115,7 @@ final class DocumentsWriter {
   }
 
   synchronized boolean doBalanceRAM() {
-    return ramBufferSize != IndexWriter.DISABLE_AUTO_FLUSH && !bufferIsFull && (numBytesUsed+deletesInRAM.bytesUsed+deletesFlushed.bytesUsed >= ramBufferSize || numBytesAlloc >= freeTrigger);
+    return ramBufferSize != IndexWriterConfig.DISABLE_AUTO_FLUSH && !bufferIsFull && (numBytesUsed+deletesInRAM.bytesUsed+deletesFlushed.bytesUsed >= ramBufferSize || numBytesAlloc >= freeTrigger);
   }
 
   /** Does the synchronized work to finish/flush the

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java Wed Mar 10 17:53:46 2010
@@ -19,7 +19,7 @@ package org.apache.lucene.index;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.Document;
-import org.apache.lucene.index.DocumentsWriter.IndexingChain;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.search.Similarity;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.store.Directory;
@@ -29,6 +29,7 @@ import org.apache.lucene.store.AlreadyCl
 import org.apache.lucene.store.BufferedIndexInput;
 import org.apache.lucene.util.Constants;
 import org.apache.lucene.util.ThreadInterruptedException;
+import org.apache.lucene.util.Version;
 
 import java.io.IOException;
 import java.io.Closeable;
@@ -179,10 +180,11 @@ public class IndexWriter implements Clos
   /**
    * Default value for the write lock timeout (1,000).
    * @see #setDefaultWriteLockTimeout
+   * @deprecated use {@link IndexWriterConfig#WRITE_LOCK_TIMEOUT} instead
    */
-  public static long WRITE_LOCK_TIMEOUT = 1000;
+  public static long WRITE_LOCK_TIMEOUT = IndexWriterConfig.WRITE_LOCK_TIMEOUT;
 
-  private long writeLockTimeout = WRITE_LOCK_TIMEOUT;
+  private long writeLockTimeout;
 
   /**
    * Name of the write lock in the index.
@@ -191,36 +193,43 @@ public class IndexWriter implements Clos
 
   /**
    * Value to denote a flush trigger is disabled
+   * @deprecated use {@link IndexWriterConfig#DISABLE_AUTO_FLUSH} instead
    */
-  public final static int DISABLE_AUTO_FLUSH = -1;
+  public final static int DISABLE_AUTO_FLUSH = IndexWriterConfig.DISABLE_AUTO_FLUSH;
 
   /**
    * Disabled by default (because IndexWriter flushes by RAM usage
    * by default). Change using {@link #setMaxBufferedDocs(int)}.
+   * @deprecated use {@link IndexWriterConfig#DEFAULT_MAX_BUFFERED_DOCS} instead.
    */
-  public final static int DEFAULT_MAX_BUFFERED_DOCS = DISABLE_AUTO_FLUSH;
+  public final static int DEFAULT_MAX_BUFFERED_DOCS = IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS;
 
   /**
    * Default value is 16 MB (which means flush when buffered
    * docs consume 16 MB RAM).  Change using {@link #setRAMBufferSizeMB}.
+   * @deprecated use {@link IndexWriterConfig#DEFAULT_RAM_BUFFER_SIZE_MB} instead.
    */
-  public final static double DEFAULT_RAM_BUFFER_SIZE_MB = 16.0;
+  public final static double DEFAULT_RAM_BUFFER_SIZE_MB = IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB;
 
   /**
    * Disabled by default (because IndexWriter flushes by RAM usage
    * by default). Change using {@link #setMaxBufferedDeleteTerms(int)}.
+   * @deprecated use {@link IndexWriterConfig#DEFAULT_MAX_BUFFERED_DELETE_TERMS} instead
    */
-  public final static int DEFAULT_MAX_BUFFERED_DELETE_TERMS = DISABLE_AUTO_FLUSH;
+  public final static int DEFAULT_MAX_BUFFERED_DELETE_TERMS = IndexWriterConfig.DEFAULT_MAX_BUFFERED_DELETE_TERMS;
 
   /**
    * Default value is 10,000. Change using {@link #setMaxFieldLength(int)}.
+   * 
+   * @deprecated see {@link IndexWriterConfig}
    */
   public final static int DEFAULT_MAX_FIELD_LENGTH = 10000;
 
   /**
    * Default value is 128. Change using {@link #setTermIndexInterval(int)}.
+   * @deprecated use {@link IndexWriterConfig#DEFAULT_TERM_INDEX_INTERVAL} instead.
    */
-  public final static int DEFAULT_TERM_INDEX_INTERVAL = 128;
+  public final static int DEFAULT_TERM_INDEX_INTERVAL = IndexWriterConfig.DEFAULT_TERM_INDEX_INTERVAL;
 
   /**
    * Absolute hard maximum length for a term.  If a term
@@ -244,10 +253,11 @@ public class IndexWriter implements Clos
   private int messageID = -1;
   volatile private boolean hitOOM;
 
-  private Directory directory;  // where this index resides
-  private Analyzer analyzer;    // how to analyze text
+  private final Directory directory;  // where this index resides
+  private final Analyzer analyzer;    // how to analyze text
 
-  private Similarity similarity = Similarity.getDefault(); // how to normalize
+  // TODO 4.0: this should be made final once the setter is out
+  private /*final*/Similarity similarity = Similarity.getDefault(); // how to normalize
 
   private volatile long changeCount; // increments every time a change is completed
   private long lastCommitChangeCount; // last changeCount that was committed
@@ -270,7 +280,8 @@ public class IndexWriter implements Clos
 
   private Lock writeLock;
 
-  private int termIndexInterval = DEFAULT_TERM_INDEX_INTERVAL;
+  // TODO 4.0: this should be made final once the setter is out
+  private /*final*/int termIndexInterval;
 
   private boolean closed;
   private boolean closing;
@@ -280,7 +291,8 @@ public class IndexWriter implements Clos
   private HashSet<SegmentInfo> mergingSegments = new HashSet<SegmentInfo>();
 
   private MergePolicy mergePolicy = new LogByteSizeMergePolicy(this);
-  private MergeScheduler mergeScheduler = new ConcurrentMergeScheduler();
+  // TODO 4.0: this should be made final once the setter is removed
+  private /*final*/MergeScheduler mergeScheduler;
   private LinkedList<MergePolicy.OneMerge> pendingMerges = new LinkedList<MergePolicy.OneMerge>();
   private Set<MergePolicy.OneMerge> runningMerges = new HashSet<MergePolicy.OneMerge>();
   private List<MergePolicy.OneMerge> mergeExceptions = new ArrayList<MergePolicy.OneMerge>();
@@ -307,7 +319,11 @@ public class IndexWriter implements Clos
   // deletes, doing merges, and reopening near real-time
   // readers.
   private volatile boolean poolReaders;
-  
+
+  // The instance that was passed to the constructor. It is saved only in order
+  // to allow users to query an IndexWriter settings.
+  private final IndexWriterConfig config;
+
   /**
    * Expert: returns a readonly reader, covering all
    * committed as well as un-committed changes to the index.
@@ -777,19 +793,29 @@ public class IndexWriter implements Clos
    *  Otherwise an IllegalArgumentException is thrown.</p>
    *
    *  @see #setUseCompoundFile(boolean)
+   *  @deprecated use {@link LogMergePolicy#getUseCompoundDocStore()} and
+   *  {@link LogMergePolicy#getUseCompoundFile()} directly.
    */
   public boolean getUseCompoundFile() {
     return getLogMergePolicy().getUseCompoundFile();
   }
 
-  /** <p>Setting to turn on usage of a compound file. When on,
-   *  multiple files for each segment are merged into a
-   *  single file when a new segment is flushed.</p>
-   *
-   *  <p>Note that this method is a convenience method: it
-   *  just calls mergePolicy.setUseCompoundFile as long as
-   *  mergePolicy is an instance of {@link LogMergePolicy}.
-   *  Otherwise an IllegalArgumentException is thrown.</p>
+  /**
+   * <p>
+   * Setting to turn on usage of a compound file. When on, multiple files for
+   * each segment are merged into a single file when a new segment is flushed.
+   * </p>
+   * 
+   * <p>
+   * Note that this method is a convenience method: it just calls
+   * mergePolicy.setUseCompoundFile as long as mergePolicy is an instance of
+   * {@link LogMergePolicy}. Otherwise an IllegalArgumentException is thrown.
+   * </p>
+   * 
+   * @deprecated use {@link LogMergePolicy#setUseCompoundDocStore(boolean)} and
+   *             {@link LogMergePolicy#setUseCompoundFile(boolean)} directly.
+   *             Note that this method set the given value on both, therefore
+   *             you should consider doing the same.
    */
   public void setUseCompoundFile(boolean value) {
     getLogMergePolicy().setUseCompoundFile(value);
@@ -799,20 +825,25 @@ public class IndexWriter implements Clos
   /** Expert: Set the Similarity implementation used by this IndexWriter.
    *
    * @see Similarity#setDefault(Similarity)
+   * @deprecated use {@link IndexWriterConfig#setSimilarity(Similarity)} instead
    */
   public void setSimilarity(Similarity similarity) {
     ensureOpen();
     this.similarity = similarity;
     docWriter.setSimilarity(similarity);
+    // Required so config.getSimilarity returns the right value. But this will
+    // go away together with the method in 4.0.
+    config.setSimilarity(similarity);
   }
 
   /** Expert: Return the Similarity implementation used by this IndexWriter.
    *
    * <p>This defaults to the current value of {@link Similarity#getDefault()}.
+   * @deprecated use {@link IndexWriterConfig#getSimilarity()} instead
    */
   public Similarity getSimilarity() {
     ensureOpen();
-    return this.similarity;
+    return similarity;
   }
 
   /** Expert: Set the interval between indexed terms.  Large values cause less
@@ -835,15 +866,20 @@ public class IndexWriter implements Clos
    * must be scanned for each random term access.
    *
    * @see #DEFAULT_TERM_INDEX_INTERVAL
+   * @deprecated use {@link IndexWriterConfig#setTermIndexInterval(int)}
    */
   public void setTermIndexInterval(int interval) {
     ensureOpen();
     this.termIndexInterval = interval;
+    // Required so config.getSimilarity returns the right value. But this will
+    // go away together with the method in 4.0.
+    config.setTermIndexInterval(interval);
   }
 
   /** Expert: Return the interval between indexed terms.
    *
    * @see #setTermIndexInterval(int)
+   * @deprecated use {@link IndexWriterConfig#getTermIndexInterval()}
    */
   public int getTermIndexInterval() {
     // We pass false because this method is called by SegmentMerger while we are in the process of closing
@@ -872,10 +908,13 @@ public class IndexWriter implements Clos
    *  if it does not exist and <code>create</code> is
    *  <code>false</code> or if there is any other low-level
    *  IO error
+   *  @deprecated use {@link #IndexWriter(Directory, IndexWriterConfig)} instead
    */
   public IndexWriter(Directory d, Analyzer a, boolean create, MaxFieldLength mfl)
        throws CorruptIndexException, LockObtainFailedException, IOException {
-    init(d, a, create, null, mfl.getLimit(), null, null);
+    this(d, new IndexWriterConfig(Version.LUCENE_31).setAnalyzer(a).setOpenMode(
+        create ? OpenMode.CREATE : OpenMode.APPEND).setMaxFieldLength(
+        mfl.getLimit()));
   }
 
   /**
@@ -895,10 +934,12 @@ public class IndexWriter implements Clos
    * @throws IOException if the directory cannot be
    *  read/written to or if there is any other low-level
    *  IO error
+   *  @deprecated use {@link #IndexWriter(Directory, IndexWriterConfig)} instead
    */
   public IndexWriter(Directory d, Analyzer a, MaxFieldLength mfl)
     throws CorruptIndexException, LockObtainFailedException, IOException {
-    init(d, a, null, mfl.getLimit(), null, null);
+    this(d, new IndexWriterConfig(Version.LUCENE_31).setAnalyzer(a)
+        .setMaxFieldLength(mfl.getLimit()));
   }
 
   /**
@@ -918,10 +959,13 @@ public class IndexWriter implements Clos
    * @throws IOException if the directory cannot be
    *  read/written to or if there is any other low-level
    *  IO error
+   *  @deprecated use {@link #IndexWriter(Directory, IndexWriterConfig)} instead
    */
   public IndexWriter(Directory d, Analyzer a, IndexDeletionPolicy deletionPolicy, MaxFieldLength mfl)
     throws CorruptIndexException, LockObtainFailedException, IOException {
-    init(d, a, deletionPolicy, mfl.getLimit(), null, null);
+    this(d, new IndexWriterConfig(Version.LUCENE_31).setAnalyzer(a)
+        .setMaxFieldLength(mfl.getLimit()).setIndexDeletionPolicy(
+            deletionPolicy));
   }
 
   /**
@@ -947,43 +991,13 @@ public class IndexWriter implements Clos
    *  if it does not exist and <code>create</code> is
    *  <code>false</code> or if there is any other low-level
    *  IO error
+   *  @deprecated use {@link #IndexWriter(Directory, IndexWriterConfig)} instead
    */
   public IndexWriter(Directory d, Analyzer a, boolean create, IndexDeletionPolicy deletionPolicy, MaxFieldLength mfl)
        throws CorruptIndexException, LockObtainFailedException, IOException {
-    init(d, a, create, deletionPolicy, mfl.getLimit(), null, null);
-  }
-  
-  /**
-   * Expert: constructs an IndexWriter with a custom {@link
-   * IndexDeletionPolicy} and {@link IndexingChain}, 
-   * for the index in <code>d</code>.
-   * Text will be analyzed with <code>a</code>.  If
-   * <code>create</code> is true, then a new, empty index
-   * will be created in <code>d</code>, replacing the index
-   * already there, if any.
-   *
-   * @param d the index directory
-   * @param a the analyzer to use
-   * @param create <code>true</code> to create the index or overwrite
-   *  the existing one; <code>false</code> to append to the existing
-   *  index
-   * @param deletionPolicy see <a href="#deletionPolicy">above</a>
-   * @param mfl whether or not to limit field lengths, value is in number of terms/tokens.  See {@link org.apache.lucene.index.IndexWriter.MaxFieldLength}.
-   * @param indexingChain the {@link DocConsumer} chain to be used to 
-   *  process documents
-   * @param commit which commit to open
-   * @throws CorruptIndexException if the index is corrupt
-   * @throws LockObtainFailedException if another writer
-   *  has this index open (<code>write.lock</code> could not
-   *  be obtained)
-   * @throws IOException if the directory cannot be read/written to, or
-   *  if it does not exist and <code>create</code> is
-   *  <code>false</code> or if there is any other low-level
-   *  IO error
-   */
-  IndexWriter(Directory d, Analyzer a, boolean create, IndexDeletionPolicy deletionPolicy, MaxFieldLength mfl, IndexingChain indexingChain, IndexCommit commit)
-       throws CorruptIndexException, LockObtainFailedException, IOException {
-    init(d, a, create, deletionPolicy, mfl.getLimit(), indexingChain, commit);
+    this(d, new IndexWriterConfig(Version.LUCENE_31).setAnalyzer(a).setOpenMode(
+        create ? OpenMode.CREATE : OpenMode.APPEND).setMaxFieldLength(
+        mfl.getLimit()).setIndexDeletionPolicy(deletionPolicy));
   }
   
   /**
@@ -1017,44 +1031,74 @@ public class IndexWriter implements Clos
    *  if it does not exist and <code>create</code> is
    *  <code>false</code> or if there is any other low-level
    *  IO error
+   *  @deprecated use {@link #IndexWriter(Directory, IndexWriterConfig)} instead
    */
   public IndexWriter(Directory d, Analyzer a, IndexDeletionPolicy deletionPolicy, MaxFieldLength mfl, IndexCommit commit)
        throws CorruptIndexException, LockObtainFailedException, IOException {
-    init(d, a, false, deletionPolicy, mfl.getLimit(), null, commit);
+    this(d, new IndexWriterConfig(Version.LUCENE_31).setAnalyzer(a)
+        .setOpenMode(OpenMode.APPEND).setMaxFieldLength(mfl.getLimit())
+        .setIndexDeletionPolicy(deletionPolicy).setIndexCommit(commit));
   }
 
-  private void init(Directory d, Analyzer a, IndexDeletionPolicy deletionPolicy, 
-                    int maxFieldLength, IndexingChain indexingChain, IndexCommit commit)
-    throws CorruptIndexException, LockObtainFailedException, IOException {
-    if (IndexReader.indexExists(d)) {
-      init(d, a, false, deletionPolicy, maxFieldLength, indexingChain, commit);
-    } else {
-      init(d, a, true, deletionPolicy, maxFieldLength, indexingChain, commit);
-    }
-  }
-
-  private void init(Directory d, Analyzer a, final boolean create,  
-                    IndexDeletionPolicy deletionPolicy, int maxFieldLength,
-                    IndexingChain indexingChain, IndexCommit commit)
-    throws CorruptIndexException, LockObtainFailedException, IOException {
-
+  /**
+   * Constructs a new IndexWriter per the settings given in <code>conf</code>.
+   * Note that the passed in {@link IndexWriterConfig} is cloned and thus making
+   * changes to it after IndexWriter has been instantiated will not affect
+   * IndexWriter. Additionally, calling {@link #getConfig()} and changing the
+   * parameters does not affect that IndexWriter instance.
+   * <p>
+   * <b>NOTE:</b> by default, {@link IndexWriterConfig#getMaxFieldLength()}
+   * returns {@link IndexWriterConfig#UNLIMITED_FIELD_LENGTH}. Pay attention to
+   * whether this setting fits your application.
+   * 
+   * @param d
+   *          the index directory. The index is either created or appended
+   *          according <code>conf.getOpenMode()</code>.
+   * @param conf
+   *          the configuration settings according to which IndexWriter should
+   *          be initalized.
+   * @throws CorruptIndexException
+   *           if the index is corrupt
+   * @throws LockObtainFailedException
+   *           if another writer has this index open (<code>write.lock</code>
+   *           could not be obtained)
+   * @throws IOException
+   *           if the directory cannot be read/written to, or if it does not
+   *           exist and <code>conf.getOpenMode()</code> is
+   *           <code>OpenMode.APPEND</code> or if there is any other low-level
+   *           IO error
+   */
+  public IndexWriter(Directory d, IndexWriterConfig conf)
+      throws CorruptIndexException, LockObtainFailedException, IOException {
+    config = (IndexWriterConfig) conf.clone();
     directory = d;
-    analyzer = a;
+    analyzer = conf.getAnalyzer();
     setMessageID(defaultInfoStream);
-    this.maxFieldLength = maxFieldLength;
-
-    if (indexingChain == null)
-      indexingChain = DocumentsWriter.DefaultIndexingChain;
+    maxFieldLength = conf.getMaxFieldLength();
+    termIndexInterval = conf.getTermIndexInterval();
+    writeLockTimeout = conf.getWriteLockTimeout();
+    similarity = conf.getSimilarity();
+    mergeScheduler = conf.getMergeScheduler();
+
+    OpenMode mode = conf.getOpenMode();
+    boolean create;
+    if (mode == OpenMode.CREATE) {
+      create = true;
+    } else if (mode == OpenMode.APPEND) {
+      create = false;
+    } else {
+      // CREATE_OR_APPEND - create only if an index does not exist
+      create = !IndexReader.indexExists(directory);
+    }
 
     if (create) {
       // Clear the write lock in case it's leftover:
       directory.clearLock(WRITE_LOCK_NAME);
     }
 
-    Lock writeLock = directory.makeLock(WRITE_LOCK_NAME);
+    writeLock = directory.makeLock(WRITE_LOCK_NAME);
     if (!writeLock.obtain(writeLockTimeout)) // obtain write lock
       throw new LockObtainFailedException("Index locked for write: " + writeLock);
-    this.writeLock = writeLock;                   // save it
 
     try {
       if (create) {
@@ -1085,6 +1129,7 @@ public class IndexWriter implements Clos
       } else {
         segmentInfos.read(directory);
 
+        IndexCommit commit = conf.getIndexCommit();
         if (commit != null) {
           // Swap out all segments, but, keep metadata in
           // SegmentInfos, like version & generation, to
@@ -1108,14 +1153,14 @@ public class IndexWriter implements Clos
 
       setRollbackSegmentInfos(segmentInfos);
 
-      docWriter = new DocumentsWriter(directory, this, indexingChain);
+      docWriter = new DocumentsWriter(directory, this, conf.getIndexingChain());
       docWriter.setInfoStream(infoStream);
       docWriter.setMaxFieldLength(maxFieldLength);
 
       // Default deleter (for backwards compatibility) is
       // KeepOnlyLastCommitDeleter:
       deleter = new IndexFileDeleter(directory,
-                                     deletionPolicy == null ? new KeepOnlyLastCommitDeletionPolicy() : deletionPolicy,
+                                     conf.getIndexDeletionPolicy(),
                                      segmentInfos, infoStream, docWriter);
 
       if (deleter.startingCommitDeleted)
@@ -1125,20 +1170,22 @@ public class IndexWriter implements Clos
         // segments_N file.
         changeCount++;
 
+      docWriter.setMaxBufferedDeleteTerms(conf.getMaxBufferedDeleteTerms());
+      docWriter.setRAMBufferSizeMB(conf.getRAMBufferSizeMB());
+      docWriter.setMaxBufferedDocs(conf.getMaxBufferedDocs());
       pushMaxBufferedDocs();
 
       if (infoStream != null) {
-        message("init: create=" + create);
         messageState();
       }
 
     } catch (IOException e) {
-      this.writeLock.release();
-      this.writeLock = null;
+      writeLock.release();
+      writeLock = null;
       throw e;
     }
   }
-
+  
   private synchronized void setRollbackSegmentInfos(SegmentInfos infos) {
     rollbackSegmentInfos = (SegmentInfos) infos.clone();
     assert !rollbackSegmentInfos.hasExternalSegments(directory);
@@ -1149,6 +1196,19 @@ public class IndexWriter implements Clos
   }
 
   /**
+   * Returns the {@link IndexWriterConfig} that was passed to
+   * {@link #IndexWriter(Directory, IndexWriterConfig)}. This allows querying
+   * IndexWriter's settings.
+   * <p>
+   * <b>NOTE:</b> setting any parameter on the returned instance has not effect
+   * on the IndexWriter instance. If you need to change those settings after
+   * IndexWriter has been created, you need to instantiate a new IndexWriter.
+   */
+  public IndexWriterConfig getConfig() {
+    return config;
+  }
+  
+  /**
    * Expert: set the merge policy used by this writer.
    */
   public void setMergePolicy(MergePolicy mp) {
@@ -1175,6 +1235,7 @@ public class IndexWriter implements Clos
 
   /**
    * Expert: set the merge scheduler used by this writer.
+   * @deprecated use {@link IndexWriterConfig#setMergeScheduler(MergeScheduler)} instead
    */
   synchronized public void setMergeScheduler(MergeScheduler mergeScheduler) throws CorruptIndexException, IOException {
     ensureOpen();
@@ -1188,12 +1249,16 @@ public class IndexWriter implements Clos
     this.mergeScheduler = mergeScheduler;
     if (infoStream != null)
       message("setMergeScheduler " + mergeScheduler);
+    // Required so config.getSimilarity returns the right value. But this will
+    // go away together with the method in 4.0.
+    config.setMergeScheduler(mergeScheduler);
   }
 
   /**
-   * Expert: returns the current MergePolicy in use by this
+   * Expert: returns the current MergeScheduler in use by this
    * writer.
-   * @see #setMergePolicy
+   * @see #setMergeScheduler(MergeScheduler)
+   * @deprecated use {@link IndexWriterConfig#getMergeScheduler()} instead
    */
   public MergeScheduler getMergeScheduler() {
     ensureOpen();
@@ -1219,6 +1284,7 @@ public class IndexWriter implements Clos
    * LogByteSizeMergePolicy}) also allows you to set this
    * limit by net size (in MB) of the segment, using {@link
    * LogByteSizeMergePolicy#setMaxMergeMB}.</p>
+   * @deprecated use {@link LogMergePolicy#setMaxMergeDocs(int)} directly.
    */
   public void setMaxMergeDocs(int maxMergeDocs) {
     getLogMergePolicy().setMaxMergeDocs(maxMergeDocs);
@@ -1234,6 +1300,7 @@ public class IndexWriter implements Clos
    * Otherwise an IllegalArgumentException is thrown.</p>
    *
    * @see #setMaxMergeDocs
+   * @deprecated use {@link LogMergePolicy#getMaxMergeDocs()} directly.
    */
   public int getMaxMergeDocs() {
     return getLogMergePolicy().getMaxMergeDocs();
@@ -1252,6 +1319,7 @@ public class IndexWriter implements Clos
    * is your memory, but you should anticipate an OutOfMemoryError.<p/>
    * By default, no more than {@link #DEFAULT_MAX_FIELD_LENGTH} terms
    * will be indexed for a field.
+   * @deprecated use {@link IndexWriterConfig#setMaxFieldLength(int)} instead
    */
   public void setMaxFieldLength(int maxFieldLength) {
     ensureOpen();
@@ -1259,12 +1327,16 @@ public class IndexWriter implements Clos
     docWriter.setMaxFieldLength(maxFieldLength);
     if (infoStream != null)
       message("setMaxFieldLength " + maxFieldLength);
+    // Required so config.getSimilarity returns the right value. But this will
+    // go away together with the method in 4.0.
+    config.setMaxFieldLength(maxFieldLength);
   }
 
   /**
    * Returns the maximum number of terms that will be
    * indexed for a single field in a document.
    * @see #setMaxFieldLength
+   * @deprecated use {@link IndexWriterConfig#getMaxFieldLength()} instead
    */
   public int getMaxFieldLength() {
     ensureOpen();
@@ -1289,6 +1361,7 @@ public class IndexWriter implements Clos
    * enabled but smaller than 2, or it disables maxBufferedDocs
    * when ramBufferSize is already disabled
    * @see #setRAMBufferSizeMB
+   * @deprecated use {@link IndexWriterConfig#setMaxBufferedDocs(int)} instead.
    */
   public void setMaxBufferedDocs(int maxBufferedDocs) {
     ensureOpen();
@@ -1303,6 +1376,9 @@ public class IndexWriter implements Clos
     pushMaxBufferedDocs();
     if (infoStream != null)
       message("setMaxBufferedDocs " + maxBufferedDocs);
+    // Required so config.getSimilarity returns the right value. But this will
+    // go away together with the method in 4.0.
+    config.setMaxBufferedDocs(maxBufferedDocs);
   }
 
   /**
@@ -1329,6 +1405,7 @@ public class IndexWriter implements Clos
    * Returns the number of buffered added documents that will
    * trigger a flush if enabled.
    * @see #setMaxBufferedDocs
+   * @deprecated use {@link IndexWriterConfig#getMaxBufferedDocs()} instead.
    */
   public int getMaxBufferedDocs() {
     ensureOpen();
@@ -1372,6 +1449,7 @@ public class IndexWriter implements Clos
    * @throws IllegalArgumentException if ramBufferSize is
    * enabled but non-positive, or it disables ramBufferSize
    * when maxBufferedDocs is already disabled
+   * @deprecated use {@link IndexWriterConfig#setRAMBufferSizeMB(double)} instead.
    */
   public void setRAMBufferSizeMB(double mb) {
     if (mb > 2048.0) {
@@ -1386,10 +1464,14 @@ public class IndexWriter implements Clos
     docWriter.setRAMBufferSizeMB(mb);
     if (infoStream != null)
       message("setRAMBufferSizeMB " + mb);
+    // Required so config.getSimilarity returns the right value. But this will
+    // go away together with the method in 4.0.
+    config.setRAMBufferSizeMB(mb);
   }
 
   /**
    * Returns the value set by {@link #setRAMBufferSizeMB} if enabled.
+   * @deprecated use {@link IndexWriterConfig#getRAMBufferSizeMB()} instead.
    */
   public double getRAMBufferSizeMB() {
     return docWriter.getRAMBufferSizeMB();
@@ -1406,6 +1488,7 @@ public class IndexWriter implements Clos
    * @throws IllegalArgumentException if maxBufferedDeleteTerms
    * is enabled but smaller than 1
    * @see #setRAMBufferSizeMB
+   * @deprecated use {@link IndexWriterConfig#setMaxBufferedDeleteTerms(int)} instead.
    */
   public void setMaxBufferedDeleteTerms(int maxBufferedDeleteTerms) {
     ensureOpen();
@@ -1416,12 +1499,16 @@ public class IndexWriter implements Clos
     docWriter.setMaxBufferedDeleteTerms(maxBufferedDeleteTerms);
     if (infoStream != null)
       message("setMaxBufferedDeleteTerms " + maxBufferedDeleteTerms);
+    // Required so config.getSimilarity returns the right value. But this will
+    // go away together with the method in 4.0.
+    config.setMaxBufferedDeleteTerms(maxBufferedDeleteTerms);
   }
 
   /**
    * Returns the number of buffered deleted terms that will
    * trigger a flush if enabled.
    * @see #setMaxBufferedDeleteTerms
+   * @deprecated use {@link IndexWriterConfig#getMaxBufferedDeleteTerms()} instead
    */
   public int getMaxBufferedDeleteTerms() {
     ensureOpen();
@@ -1442,6 +1529,7 @@ public class IndexWriter implements Clos
    * Otherwise an IllegalArgumentException is thrown.</p>
    *
    * <p>This must never be less than 2.  The default value is 10.
+   * @deprecated use {@link LogMergePolicy#setMergeFactor(int)} directly.
    */
   public void setMergeFactor(int mergeFactor) {
     getLogMergePolicy().setMergeFactor(mergeFactor);
@@ -1458,6 +1546,7 @@ public class IndexWriter implements Clos
    * Otherwise an IllegalArgumentException is thrown.</p>
    *
    * @see #setMergeFactor
+   * @deprecated use {@link LogMergePolicy#getMergeFactor()} directly.
    */
   public int getMergeFactor() {
     return getLogMergePolicy().getMergeFactor();
@@ -1494,15 +1583,11 @@ public class IndexWriter implements Clos
   }
 
   private void messageState() {
-    message("setInfoStream: dir=" + directory +
-            " mergePolicy=" + mergePolicy +
-            " mergeScheduler=" + mergeScheduler +
-            " ramBufferSizeMB=" + docWriter.getRAMBufferSizeMB() +
-            " maxBufferedDocs=" + docWriter.getMaxBufferedDocs() +
-            " maxBuffereDeleteTerms=" + docWriter.getMaxBufferedDeleteTerms() +
-            " maxFieldLength=" + maxFieldLength +
-            " index=" + segString() +
-            " version=" + Constants.LUCENE_VERSION);
+    message("\ndir=" + directory + "\n" +
+            "mergePolicy=" + mergePolicy + "\n" + 
+            "index=" + segString() + "\n" +
+            "version=" + Constants.LUCENE_VERSION + "\n" +
+            config.toString());
   }
 
   /**
@@ -1522,15 +1607,20 @@ public class IndexWriter implements Clos
   /**
    * Sets the maximum time to wait for a write lock (in milliseconds) for this instance of IndexWriter.  @see
    * @see #setDefaultWriteLockTimeout to change the default value for all instances of IndexWriter.
+   * @deprecated use {@link IndexWriterConfig#setWriteLockTimeout(long)} instead
    */
   public void setWriteLockTimeout(long writeLockTimeout) {
     ensureOpen();
     this.writeLockTimeout = writeLockTimeout;
+    // Required so config.getSimilarity returns the right value. But this will
+    // go away together with the method in 4.0.
+    config.setWriteLockTimeout(writeLockTimeout);
   }
 
   /**
    * Returns allowed timeout when acquiring the write lock.
    * @see #setWriteLockTimeout
+   * @deprecated use {@link IndexWriterConfig#getWriteLockTimeout()}
    */
   public long getWriteLockTimeout() {
     ensureOpen();
@@ -1540,18 +1630,20 @@ public class IndexWriter implements Clos
   /**
    * Sets the default (for any instance of IndexWriter) maximum time to wait for a write lock (in
    * milliseconds).
+   * @deprecated use {@link IndexWriterConfig#setDefaultWriteLockTimeout(long)} instead
    */
   public static void setDefaultWriteLockTimeout(long writeLockTimeout) {
-    IndexWriter.WRITE_LOCK_TIMEOUT = writeLockTimeout;
+    IndexWriterConfig.setDefaultWriteLockTimeout(writeLockTimeout);
   }
 
   /**
    * Returns default write lock timeout for newly
    * instantiated IndexWriters.
    * @see #setDefaultWriteLockTimeout
+   * @deprecated use {@link IndexWriterConfig#getDefaultWriteLockTimeout()} instead
    */
   public static long getDefaultWriteLockTimeout() {
-    return IndexWriter.WRITE_LOCK_TIMEOUT;
+    return IndexWriterConfig.getDefaultWriteLockTimeout();
   }
 
   /**
@@ -4785,9 +4877,13 @@ public class IndexWriter implements Clos
   }
 
   /**
-   * Specifies maximum field length (in number of tokens/terms) in {@link IndexWriter} constructors.
-   * {@link #setMaxFieldLength(int)} overrides the value set by
-   * the constructor.
+   * Specifies maximum field length (in number of tokens/terms) in
+   * {@link IndexWriter} constructors. {@link #setMaxFieldLength(int)} overrides
+   * the value set by the constructor.
+   * 
+   * @deprecated use {@link IndexWriterConfig} and pass
+   *             {@link IndexWriterConfig#UNLIMITED_FIELD_LENGTH} or your own
+   *             value.
    */
   public static final class MaxFieldLength {
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java Wed Mar 10 17:53:46 2010
@@ -48,7 +48,7 @@ final class SegmentMerger {
   
   private Directory directory;
   private String segment;
-  private int termIndexInterval = IndexWriter.DEFAULT_TERM_INDEX_INTERVAL;
+  private int termIndexInterval = IndexWriterConfig.DEFAULT_TERM_INDEX_INTERVAL;
 
   private List<IndexReader> readers = new ArrayList<IndexReader>();
   private FieldInfos fieldInfos;
@@ -96,7 +96,7 @@ final class SegmentMerger {
         }
       };
     }
-    termIndexInterval = writer.getTermIndexInterval();
+    termIndexInterval = writer.getConfig().getTermIndexInterval();
   }
   
   boolean hasProx() {

Modified: lucene/java/trunk/src/test/org/apache/lucene/TestDemo.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/TestDemo.java?rev=921480&r1=921479&r2=921480&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/TestDemo.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/TestDemo.java Wed Mar 10 17:53:46 2010
@@ -24,6 +24,7 @@ import org.apache.lucene.analysis.standa
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.queryParser.QueryParser;
 import org.apache.lucene.search.IndexSearcher;
@@ -49,8 +50,9 @@ public class TestDemo extends LuceneTest
     Directory directory = new RAMDirectory();
     // To store an index on disk, use this instead:
     //Directory directory = FSDirectory.open("/tmp/testindex");
-    IndexWriter iwriter = new IndexWriter(directory, analyzer, true,
-                                          new IndexWriter.MaxFieldLength(25000));
+    IndexWriter iwriter = new IndexWriter(directory, new IndexWriterConfig(
+        TEST_VERSION_CURRENT).setAnalyzer(analyzer).setMaxFieldLength(25000));
+    
     Document doc = new Document();
     String text = "This is the text to be indexed.";
     doc.add(new Field("fieldname", text, Field.Store.YES,



Mime
View raw message