lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sh...@apache.org
Subject svn commit: r1060342 - in /lucene/dev/branches/branch_3x: lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ lucene/contrib/demo/src/java/org/apache/lucene/demo/ lucene/src/java/org/apache/lucene/index/ lucene/src/test/org/apac...
Date Tue, 18 Jan 2011 12:03:13 GMT
Author: shaie
Date: Tue Jan 18 12:03:12 2011
New Revision: 1060342

URL: http://svn.apache.org/viewvc?rev=1060342&view=rev
Log:
LUCENE-2295: remove maxFieldLength from IndexWriterConfig (3x)

Modified:
    lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTask.java
    lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenIndexTask.java
    lucene/dev/branches/branch_3x/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexHTML.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriterConfig.java
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/update/SolrIndexConfig.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/update/SolrIndexWriter.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/TestSort.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java

Modified: lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTask.java?rev=1060342&r1=1060341&r2=1060342&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTask.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/CreateIndexTask.java
Tue Jan 18 12:03:12 2011
@@ -147,7 +147,6 @@ public class CreateIndexTask extends Per
         logMergePolicy.setMergeFactor(config.get("merge.factor",OpenIndexTask.DEFAULT_MERGE_PFACTOR));
       }
     }
-    iwConf.setMaxFieldLength(config.get("max.field.length",OpenIndexTask.DEFAULT_MAX_FIELD_LENGTH));
     final double ramBuffer = config.get("ram.flush.mb",OpenIndexTask.DEFAULT_RAM_FLUSH_MB);
     final int maxBuffered = config.get("max.buffered",OpenIndexTask.DEFAULT_MAX_BUFFERED);
     if (maxBuffered == IndexWriterConfig.DISABLE_AUTO_FLUSH) {
@@ -163,6 +162,8 @@ public class CreateIndexTask extends Per
   
   public static IndexWriter configureWriter(Config config, PerfRunData runData, OpenMode
mode, IndexCommit commit) throws CorruptIndexException, LockObtainFailedException, IOException
{
     IndexWriter writer = new IndexWriter(runData.getDirectory(), createWriterConfig(config,
runData, mode, commit));
+    writer.setMaxFieldLength(config.get("max.field.length", OpenIndexTask.DEFAULT_MAX_FIELD_LENGTH));
+
     String infoStreamVal = config.get("writer.info.stream", null);
     if (infoStreamVal != null) {
       if (infoStreamVal.equals("SystemOut")) {

Modified: lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenIndexTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenIndexTask.java?rev=1060342&r1=1060341&r2=1060342&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenIndexTask.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenIndexTask.java
Tue Jan 18 12:03:12 2011
@@ -23,6 +23,7 @@ import org.apache.lucene.index.IndexWrit
 import org.apache.lucene.index.IndexCommit;
 import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.LogMergePolicy;
+import org.apache.lucene.index.IndexWriter.MaxFieldLength;
 import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import java.io.IOException;
 
@@ -41,7 +42,7 @@ import java.io.IOException;
 public class OpenIndexTask extends PerfTask {
 
   public static final int DEFAULT_MAX_BUFFERED = IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS;
-  public static final int DEFAULT_MAX_FIELD_LENGTH = IndexWriterConfig.UNLIMITED_FIELD_LENGTH;
+  public static final int DEFAULT_MAX_FIELD_LENGTH = MaxFieldLength.UNLIMITED.getLimit();
   public static final int DEFAULT_MERGE_PFACTOR = LogMergePolicy.DEFAULT_MERGE_FACTOR;
   public static final double DEFAULT_RAM_FLUSH_MB = (int) IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB;
   private String commitUserData;

Modified: lucene/dev/branches/branch_3x/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexHTML.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexHTML.java?rev=1060342&r1=1060341&r2=1060342&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexHTML.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexHTML.java
Tue Jan 18 12:03:12 2011
@@ -79,10 +79,10 @@ public class IndexHTML {
         deleting = true;
         indexDocs(root, index, create);
       }
-      writer = new IndexWriter(FSDirectory.open(index), new IndexWriterConfig(
-          Version.LUCENE_CURRENT, new StandardAnalyzer(Version.LUCENE_CURRENT))
-          .setMaxFieldLength(1000000).setOpenMode(
-              create ? OpenMode.CREATE : OpenMode.CREATE_OR_APPEND));
+      writer = new IndexWriter(FSDirectory.open(index),
+          new IndexWriterConfig(Version.LUCENE_CURRENT, new StandardAnalyzer(
+              Version.LUCENE_CURRENT)).setOpenMode(create ? OpenMode.CREATE
+              : OpenMode.CREATE_OR_APPEND));
       indexDocs(root, index, create);		  // add new docs
 
       System.out.println("Optimizing index...");

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java?rev=1060342&r1=1060341&r2=1060342&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java
Tue Jan 18 12:03:12 2011
@@ -124,7 +124,7 @@ final class DocumentsWriter {
   private boolean aborting;               // True if an abort is pending
 
   PrintStream infoStream;
-  int maxFieldLength = IndexWriterConfig.UNLIMITED_FIELD_LENGTH;
+  int maxFieldLength = IndexWriter.DEFAULT_MAX_FIELD_LENGTH;
   Similarity similarity;
 
   // max # simultaneous threads; if there are more than

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java?rev=1060342&r1=1060341&r2=1060342&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java
Tue Jan 18 12:03:12 2011
@@ -33,6 +33,8 @@ import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.LimitTokenCountAnalyzer;
+import org.apache.lucene.analysis.LimitTokenCountFilter;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.index.PayloadProcessorProvider.DirPayloadProcessor;
@@ -232,7 +234,7 @@ public class IndexWriter implements Clos
    * @deprecated see {@link IndexWriterConfig}
    */
   @Deprecated
-  public final static int DEFAULT_MAX_FIELD_LENGTH = 10000;
+  public final static int DEFAULT_MAX_FIELD_LENGTH = MaxFieldLength.UNLIMITED.getLimit();
 
   /**
    * Default value is 128. Change using {@link #setTermIndexInterval(int)}.
@@ -877,8 +879,8 @@ public class IndexWriter implements Clos
   public IndexWriter(Directory d, Analyzer a, boolean create, MaxFieldLength mfl)
        throws CorruptIndexException, LockObtainFailedException, IOException {
     this(d, new IndexWriterConfig(Version.LUCENE_31, a).setOpenMode(
-        create ? OpenMode.CREATE : OpenMode.APPEND).setMaxFieldLength(
-        mfl.getLimit()));
+        create ? OpenMode.CREATE : OpenMode.APPEND));
+    setMaxFieldLength(mfl.getLimit());
   }
 
   /**
@@ -903,8 +905,8 @@ public class IndexWriter implements Clos
   @Deprecated
   public IndexWriter(Directory d, Analyzer a, MaxFieldLength mfl)
     throws CorruptIndexException, LockObtainFailedException, IOException {
-    this(d, new IndexWriterConfig(Version.LUCENE_31, a)
-        .setMaxFieldLength(mfl.getLimit()));
+    this(d, new IndexWriterConfig(Version.LUCENE_31, a));
+    setMaxFieldLength(mfl.getLimit());
   }
 
   /**
@@ -929,8 +931,8 @@ public class IndexWriter implements Clos
   @Deprecated
   public IndexWriter(Directory d, Analyzer a, IndexDeletionPolicy deletionPolicy, MaxFieldLength
mfl)
     throws CorruptIndexException, LockObtainFailedException, IOException {
-    this(d, new IndexWriterConfig(Version.LUCENE_31, a).setMaxFieldLength(
-        mfl.getLimit()).setIndexDeletionPolicy(deletionPolicy));
+    this(d, new IndexWriterConfig(Version.LUCENE_31, a).setIndexDeletionPolicy(deletionPolicy));
+    setMaxFieldLength(mfl.getLimit());
   }
 
   /**
@@ -962,8 +964,8 @@ public class IndexWriter implements Clos
   public IndexWriter(Directory d, Analyzer a, boolean create, IndexDeletionPolicy deletionPolicy,
MaxFieldLength mfl)
        throws CorruptIndexException, LockObtainFailedException, IOException {
     this(d, new IndexWriterConfig(Version.LUCENE_31, a).setOpenMode(
-        create ? OpenMode.CREATE : OpenMode.APPEND).setMaxFieldLength(
-        mfl.getLimit()).setIndexDeletionPolicy(deletionPolicy));
+        create ? OpenMode.CREATE : OpenMode.APPEND).setIndexDeletionPolicy(deletionPolicy));
+    setMaxFieldLength(mfl.getLimit());
   }
   
   /**
@@ -1003,8 +1005,8 @@ public class IndexWriter implements Clos
   public IndexWriter(Directory d, Analyzer a, IndexDeletionPolicy deletionPolicy, MaxFieldLength
mfl, IndexCommit commit)
        throws CorruptIndexException, LockObtainFailedException, IOException {
     this(d, new IndexWriterConfig(Version.LUCENE_31, a)
-        .setOpenMode(OpenMode.APPEND).setMaxFieldLength(mfl.getLimit())
-        .setIndexDeletionPolicy(deletionPolicy).setIndexCommit(commit));
+        .setOpenMode(OpenMode.APPEND).setIndexDeletionPolicy(deletionPolicy).setIndexCommit(commit));
+    setMaxFieldLength(mfl.getLimit());
   }
 
   /**
@@ -1041,7 +1043,6 @@ public class IndexWriter implements Clos
     directory = d;
     analyzer = conf.getAnalyzer();
     infoStream = defaultInfoStream;
-    maxFieldLength = conf.getMaxFieldLength();
     termIndexInterval = conf.getTermIndexInterval();
     writeLockTimeout = conf.getWriteLockTimeout();
     similarity = conf.getSimilarity();
@@ -1338,18 +1339,25 @@ public class IndexWriter implements Clos
 
   /**
    * The maximum number of terms that will be indexed for a single field in a
-   * document.  This limits the amount of memory required for indexing, so that
+   * document. This limits the amount of memory required for indexing, so that
    * collections with very large files will not crash the indexing process by
-   * running out of memory.  This setting refers to the number of running terms,
-   * not to the number of different terms.<p/>
-   * <strong>Note:</strong> this silently truncates large documents, excluding
from the
-   * index all terms that occur further in the document.  If you know your source
-   * documents are large, be sure to set this value high enough to accomodate
-   * the expected size.  If you set it to Integer.MAX_VALUE, then the only limit
-   * 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
+   * running out of memory. This setting refers to the number of running terms,
+   * not to the number of different terms.
+   * <p/>
+   * <strong>Note:</strong> this silently truncates large documents, excluding
+   * from the index all terms that occur further in the document. If you know
+   * your source documents are large, be sure to set this value high enough to
+   * accomodate the expected size. If you set it to Integer.MAX_VALUE, then the
+   * only limit 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 LimitTokenCountAnalyzer} instead. Note that the
+   *             behvaior slightly changed - the analyzer limits the number of
+   *             tokens per token stream created, while this setting limits the
+   *             total number of tokens to index. This only matters if you index
+   *             many multi-valued fields though.
    */
   @Deprecated
   public void setMaxFieldLength(int maxFieldLength) {
@@ -1358,16 +1366,13 @@ public class IndexWriter implements Clos
     docWriter.setMaxFieldLength(maxFieldLength);
     if (infoStream != null)
       message("setMaxFieldLength " + maxFieldLength);
-    // Required so config.getMaxFieldLength 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
+   * @deprecated use {@link LimitTokenCountAnalyzer} to limit number of tokens.
    */
   @Deprecated
   public int getMaxFieldLength() {
@@ -1956,8 +1961,9 @@ public class IndexWriter implements Clos
    * By default, no more than 10,000 terms will be indexed for a field.
    *
    * @see MaxFieldLength
+   * @deprecated remove in 4.0
    */
-  private int maxFieldLength;
+  private int maxFieldLength = DEFAULT_MAX_FIELD_LENGTH;
 
   /**
    * Adds a document to this index.  If the document contains more than
@@ -4281,7 +4287,7 @@ public class IndexWriter implements Clos
      * {@link #DEFAULT_MAX_FIELD_LENGTH} 
      * */
     public static final MaxFieldLength LIMITED
-        = new MaxFieldLength("LIMITED", DEFAULT_MAX_FIELD_LENGTH);
+        = new MaxFieldLength("LIMITED", 10000);
   }
 
   /** If {@link #getReader} has been called (ie, this writer

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriterConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriterConfig.java?rev=1060342&r1=1060341&r2=1060342&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriterConfig.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriterConfig.java
Tue Jan 18 12:03:12 2011
@@ -40,8 +40,6 @@ import org.apache.lucene.util.Version;
  */
 public final class IndexWriterConfig implements Cloneable {
 
-  public static final int UNLIMITED_FIELD_LENGTH = Integer.MAX_VALUE;
-
   /**
    * Specifies the open mode for {@link IndexWriter}:
    * <ul>
@@ -112,7 +110,6 @@ public final class IndexWriterConfig imp
   private IndexDeletionPolicy delPolicy;
   private IndexCommit commit;
   private OpenMode openMode;
-  private int maxFieldLength;
   private Similarity similarity;
   private int termIndexInterval;
   private MergeScheduler mergeScheduler;
@@ -143,7 +140,6 @@ public final class IndexWriterConfig imp
     delPolicy = new KeepOnlyLastCommitDeletionPolicy();
     commit = null;
     openMode = OpenMode.CREATE_OR_APPEND;
-    maxFieldLength = UNLIMITED_FIELD_LENGTH;
     similarity = Similarity.getDefault();
     termIndexInterval = DEFAULT_TERM_INDEX_INTERVAL;
     mergeScheduler = new ConcurrentMergeScheduler();
@@ -217,37 +213,6 @@ public final class IndexWriterConfig imp
   }
 
   /**
-   * The maximum number of terms that will be indexed for a single field in a
-   * document. This limits the amount of memory required for indexing, so that
-   * collections with very large files will not crash the indexing process by
-   * running out of memory. This setting refers to the number of running terms,
-   * not to the number of different terms.
-   * <p>
-   * <b>NOTE:</b> this silently truncates large documents, excluding from the
-   * index all terms that occur further in the document. If you know your source
-   * documents are large, be sure to set this value high enough to accomodate
-   * the expected size. If you set it to {@link #UNLIMITED_FIELD_LENGTH}, then
-   * the only limit is your memory, but you should anticipate an
-   * OutOfMemoryError.
-   * <p>
-   * By default it is set to {@link #UNLIMITED_FIELD_LENGTH}.
-   */
-  public IndexWriterConfig setMaxFieldLength(int maxFieldLength) {
-    this.maxFieldLength = maxFieldLength;
-    return this;
-  }
-
-  /**
-   * Returns the maximum number of terms that will be indexed for a single field
-   * in a document.
-   * 
-   * @see #setMaxFieldLength(int)
-   */
-  public int getMaxFieldLength() {
-    return maxFieldLength;
-  }
-
-  /**
    * Expert: allows to open a certain commit point. The default is null which
    * opens the latest commit point.
    */
@@ -596,7 +561,6 @@ public final class IndexWriterConfig imp
     sb.append("delPolicy=").append(delPolicy.getClass().getName()).append("\n");
     sb.append("commit=").append(commit == null ? "null" : commit).append("\n");
     sb.append("openMode=").append(openMode).append("\n");
-    sb.append("maxFieldLength=").append(maxFieldLength).append("\n");
     sb.append("similarity=").append(similarity.getClass().getName()).append("\n");
     sb.append("termIndexInterval=").append(termIndexInterval).append("\n");
     sb.append("mergeScheduler=").append(mergeScheduler.getClass().getName()).append("\n");

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=1060342&r1=1060341&r2=1060342&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
Tue Jan 18 12:03:12 2011
@@ -947,7 +947,8 @@ public class TestIndexWriter extends Luc
     public void testHighFreqTerm() throws IOException {
       MockDirectoryWrapper dir = newDirectory();      
       IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(
-          TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxFieldLength(100000000).setRAMBufferSizeMB(0.01));
+          TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setRAMBufferSizeMB(0.01));
+      writer.setMaxFieldLength(100000000);
       // Massive doc that has 128 K a's
       StringBuilder b = new StringBuilder(1024*1024);
       for(int i=0;i<4096;i++) {
@@ -1395,7 +1396,8 @@ public class TestIndexWriter extends Luc
     Directory dir = newDirectory();
 
     IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
-        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxFieldLength(100000));
+        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)));
+    writer.setMaxFieldLength(100000);
 
     Document doc = new Document();
     StringBuilder b = new StringBuilder();

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.java?rev=1060342&r1=1060341&r2=1060342&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.java
Tue Jan 18 12:03:12 2011
@@ -65,7 +65,6 @@ public class TestIndexWriterConfig exten
     assertEquals(WhitespaceAnalyzer.class, conf.getAnalyzer().getClass());
     assertNull(conf.getIndexCommit());
     assertEquals(KeepOnlyLastCommitDeletionPolicy.class, conf.getIndexDeletionPolicy().getClass());
-    assertEquals(IndexWriterConfig.UNLIMITED_FIELD_LENGTH, conf.getMaxFieldLength());
     assertEquals(ConcurrentMergeScheduler.class, conf.getMergeScheduler().getClass());
     assertEquals(OpenMode.CREATE_OR_APPEND, conf.getOpenMode());
     assertTrue(Similarity.getDefault() == conf.getSimilarity());
@@ -87,7 +86,6 @@ public class TestIndexWriterConfig exten
     getters.add("getAnalyzer");
     getters.add("getIndexCommit");
     getters.add("getIndexDeletionPolicy");
-    getters.add("getMaxFieldLength");
     getters.add("getMergeScheduler");
     getters.add("getOpenMode");
     getters.add("getSimilarity");
@@ -129,7 +127,6 @@ public class TestIndexWriterConfig exten
     // Tests that the values of the constants does not change
     assertEquals(1000, IndexWriterConfig.WRITE_LOCK_TIMEOUT);
     assertEquals(128, IndexWriterConfig.DEFAULT_TERM_INDEX_INTERVAL);
-    assertEquals(Integer.MAX_VALUE, IndexWriterConfig.UNLIMITED_FIELD_LENGTH);
     assertEquals(-1, IndexWriterConfig.DISABLE_AUTO_FLUSH);
     assertEquals(IndexWriterConfig.DISABLE_AUTO_FLUSH, IndexWriterConfig.DEFAULT_MAX_BUFFERED_DELETE_TERMS);
     assertEquals(IndexWriterConfig.DISABLE_AUTO_FLUSH, IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS);
@@ -269,9 +266,6 @@ public class TestIndexWriterConfig exten
 
     writer.setMaxBufferedDocs(10);
     assertEquals(10, writer.getConfig().getMaxBufferedDocs());
-
-    writer.setMaxFieldLength(10);
-    assertEquals(10, writer.getConfig().getMaxFieldLength());
     
     writer.setMergeScheduler(new SerialMergeScheduler());
     assertEquals(SerialMergeScheduler.class, writer.getConfig().getMergeScheduler().getClass());

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java?rev=1060342&r1=1060341&r2=1060342&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java
Tue Jan 18 12:03:12 2011
@@ -92,7 +92,6 @@ public class FileBasedSpellChecker exten
             new IndexWriterConfig(core.getSolrConfig().luceneMatchVersion, fieldType.getAnalyzer()).
                 setMaxBufferedDocs(150).
                 setMergePolicy(mp).
-                setMaxFieldLength(IndexWriterConfig.UNLIMITED_FIELD_LENGTH).
                 setOpenMode(IndexWriterConfig.OpenMode.CREATE)
         );
 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/update/SolrIndexConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/update/SolrIndexConfig.java?rev=1060342&r1=1060341&r2=1060342&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/update/SolrIndexConfig.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/update/SolrIndexConfig.java
Tue Jan 18 12:03:12 2011
@@ -153,9 +153,6 @@ public class SolrIndexConfig {
     if (termIndexInterval != -1)
       iwc.setTermIndexInterval(termIndexInterval);
 
-    if (maxFieldLength != -1)
-      iwc.setMaxFieldLength(maxFieldLength);
-
     if (writeLockTimeout != -1)
       iwc.setWriteLockTimeout(writeLockTimeout);
 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/update/SolrIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/update/SolrIndexWriter.java?rev=1060342&r1=1060341&r2=1060342&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/update/SolrIndexWriter.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/update/SolrIndexWriter.java
Tue Jan 18 12:03:12 2011
@@ -86,6 +86,10 @@ public class SolrIndexWriter extends Ind
             setOpenMode(create ? IndexWriterConfig.OpenMode.CREATE : IndexWriterConfig.OpenMode.APPEND).
             setIndexDeletionPolicy(delPolicy)
     );
+
+    if (config.maxFieldLength != -1)
+      setMaxFieldLength(config.maxFieldLength);
+
     log.debug("Opened Writer " + name);
     this.name = name;
 

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java?rev=1060342&r1=1060341&r2=1060342&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/core/TestArbitraryIndexDir.java
Tue Jan 18 12:03:12 2011
@@ -98,9 +98,7 @@ public class TestArbitraryIndexDir exten
     Directory dir = newFSDirectory(newDir);
     IndexWriter iw = new IndexWriter(
         dir,
-        new IndexWriterConfig(TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT)).
-            setMaxFieldLength(1000)
-    );
+        new IndexWriterConfig(TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT)));
     Document doc = new Document();
     doc.add(new Field("id", "2", Field.Store.YES, Field.Index.ANALYZED));
     doc.add(new Field("name", "name2", Field.Store.YES, Field.Index.ANALYZED));

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/TestSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/TestSort.java?rev=1060342&r1=1060341&r2=1060342&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/TestSort.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/TestSort.java Tue Jan
18 12:03:12 2011
@@ -33,7 +33,9 @@ import java.io.IOException;
 import java.util.*;
 
 public class TestSort extends AbstractSolrTestCase {
+  @Override
   public String getSchemaFile() { return null; }
+  @Override
   public String getSolrConfigFile() { return null; }
 
   Random r = random;
@@ -49,6 +51,7 @@ public class TestSort extends AbstractSo
     String val;
     String val2;
 
+    @Override
     public String toString() {
       return "{id=" +doc + " val1="+val + " val2="+val2 + "}";
     }
@@ -63,9 +66,7 @@ public class TestSort extends AbstractSo
       IndexWriter iw = new IndexWriter(
           dir,
           new IndexWriterConfig(TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)).
-              setOpenMode(IndexWriterConfig.OpenMode.CREATE).
-              setMaxFieldLength(IndexWriterConfig.UNLIMITED_FIELD_LENGTH)
-      );
+              setOpenMode(IndexWriterConfig.OpenMode.CREATE));
       final MyDoc[] mydocs = new MyDoc[ndocs];
 
       int v1EmptyPercent = 50;

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java?rev=1060342&r1=1060341&r2=1060342&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java
Tue Jan 18 12:03:12 2011
@@ -284,9 +284,7 @@ public class IndexBasedSpellCheckerTest 
     Directory dir = newFSDirectory(altIndexDir);
     IndexWriter iw = new IndexWriter(
         dir,
-        new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).
-            setMaxFieldLength(IndexWriterConfig.UNLIMITED_FIELD_LENGTH)
-    );
+        new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)));
     for (int i = 0; i < ALT_DOCS.length; i++) {
       Document doc = new Document();
       doc.add(new Field("title", ALT_DOCS[i], Field.Store.YES, Field.Index.ANALYZED));



Mime
View raw message