You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by mi...@apache.org on 2008/01/25 11:21:25 UTC
svn commit: r615168 - in /lucene/java/trunk: ./
contrib/benchmark/src/java/org/apache/lucene/benchmark/standard/
contrib/miscellaneous/src/java/org/apache/lucene/misc/
contrib/regex/src/test/org/apache/lucene/search/regex/
contrib/surround/src/test/org...
Author: mikemccand
Date: Fri Jan 25 02:21:15 2008
New Revision: 615168
URL: http://svn.apache.org/viewvc?rev=615168&view=rev
Log:
LUCENE-1084: change all IW ctors to require up-front specification of max field length; deprecated existing ones
Modified:
lucene/java/trunk/CHANGES.txt
lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/standard/StandardBenchmarker.java
lucene/java/trunk/contrib/miscellaneous/src/java/org/apache/lucene/misc/IndexMergeTool.java
lucene/java/trunk/contrib/regex/src/test/org/apache/lucene/search/regex/TestRegexQuery.java
lucene/java/trunk/contrib/surround/src/test/org/apache/lucene/queryParser/surround/query/SingleFieldTestDb.java
lucene/java/trunk/contrib/swing/src/java/org/apache/lucene/swing/models/ListSearcher.java
lucene/java/trunk/contrib/wordnet/src/java/org/apache/lucene/wordnet/Syns2Index.java
lucene/java/trunk/src/demo/org/apache/lucene/demo/IndexFiles.java
lucene/java/trunk/src/demo/org/apache/lucene/demo/IndexHTML.java
lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
lucene/java/trunk/src/test/org/apache/lucene/IndexTest.java
lucene/java/trunk/src/test/org/apache/lucene/TestDemo.java
lucene/java/trunk/src/test/org/apache/lucene/TestHitIterator.java
lucene/java/trunk/src/test/org/apache/lucene/TestSearch.java
lucene/java/trunk/src/test/org/apache/lucene/TestSearchForDuplicates.java
lucene/java/trunk/src/test/org/apache/lucene/TestSnapshotDeletionPolicy.java
lucene/java/trunk/src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java
lucene/java/trunk/src/test/org/apache/lucene/index/TestCheckIndex.java
lucene/java/trunk/src/test/org/apache/lucene/index/TestFilterIndexReader.java
lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java
lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java
lucene/java/trunk/src/test/org/apache/lucene/index/TestSegmentTermDocs.java
lucene/java/trunk/src/test/org/apache/lucene/search/BaseTestRangeFilter.java
lucene/java/trunk/src/test/org/apache/lucene/search/TestConstantScoreRangeQuery.java
lucene/java/trunk/src/test/org/apache/lucene/search/TestDateSort.java
lucene/java/trunk/src/test/org/apache/lucene/search/TestExplanations.java
lucene/java/trunk/src/test/org/apache/lucene/search/TestMultiSearcherRanking.java
lucene/java/trunk/src/test/org/apache/lucene/search/TestPhraseQuery.java
lucene/java/trunk/src/test/org/apache/lucene/search/TestPositionIncrement.java
lucene/java/trunk/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java
lucene/java/trunk/src/test/org/apache/lucene/search/TestSimilarity.java
lucene/java/trunk/src/test/org/apache/lucene/search/TestSpanQueryFilter.java
lucene/java/trunk/src/test/org/apache/lucene/search/TestTermVectors.java
lucene/java/trunk/src/test/org/apache/lucene/search/function/FunctionTestSetup.java
lucene/java/trunk/src/test/org/apache/lucene/search/spans/TestBasics.java
lucene/java/trunk/src/test/org/apache/lucene/store/TestLockFactory.java
Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Fri Jan 25 02:21:15 2008
@@ -7,6 +7,11 @@
API Changes
+ 1. LUCENE-1084: Changed all IndexWriter constructors to take an
+ explicit parameter for maximum field size. Deprecated all the
+ pre-existing constructors; these will be removed in release 3.0.
+ (Steven Rowe via Mike McCandless)
+
Bug fixes
New features
Modified: lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/standard/StandardBenchmarker.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/standard/StandardBenchmarker.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/standard/StandardBenchmarker.java (original)
+++ lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/standard/StandardBenchmarker.java Fri Jan 25 02:21:15 2008
@@ -133,7 +133,7 @@
TestRunData trd = new TestRunData();
trd.startRun();
trd.setId(String.valueOf(i));
- IndexWriter iw = new IndexWriter(params.getDirectory(), params.getAnalyzer(), true);
+ IndexWriter iw = new IndexWriter(params.getDirectory(), params.getAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
iw.setMergeFactor(params.getMergeFactor());
iw.setMaxBufferedDocs(params.getMaxBufferedDocs());
Modified: lucene/java/trunk/contrib/miscellaneous/src/java/org/apache/lucene/misc/IndexMergeTool.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/miscellaneous/src/java/org/apache/lucene/misc/IndexMergeTool.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/contrib/miscellaneous/src/java/org/apache/lucene/misc/IndexMergeTool.java (original)
+++ lucene/java/trunk/contrib/miscellaneous/src/java/org/apache/lucene/misc/IndexMergeTool.java Fri Jan 25 02:21:15 2008
@@ -38,7 +38,7 @@
}
File mergedIndex = new File(args[0]);
- IndexWriter writer = new IndexWriter(mergedIndex, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(mergedIndex, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
Directory[] indexes = new Directory[args.length - 1];
for (int i = 1; i < args.length; i++) {
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=615168&r1=615167&r2=615168&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 Fri Jan 25 02:21:15 2008
@@ -36,7 +36,8 @@
public void setUp() {
RAMDirectory directory = new RAMDirectory();
try {
- IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field(FN, "the quick brown fox jumps over the lazy dog", Field.Store.NO, Field.Index.TOKENIZED));
writer.addDocument(doc);
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=615168&r1=615167&r2=615168&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 Fri Jan 25 02:21:15 2008
@@ -36,7 +36,8 @@
docs = documents;
fieldName = fName;
Analyzer analyzer = new WhitespaceAnalyzer();
- IndexWriter writer = new IndexWriter(db, analyzer, true);
+ IndexWriter writer = new IndexWriter(db, analyzer, true,
+ IndexWriter.MaxFieldLength.LIMITED);
for (int j = 0; j < docs.length; j++) {
Document d = new Document();
d.add(new Field(fieldName, docs[j], Field.Store.NO, Field.Index.TOKENIZED));
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=615168&r1=615167&r2=615168&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 Fri Jan 25 02:21:15 2008
@@ -111,7 +111,7 @@
try {
// recreate the RAMDirectory
directory = new RAMDirectory();
- IndexWriter writer = new IndexWriter(directory, analyzer, true);
+ IndexWriter writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
// iterate through all rows
for (int row=0; row < listModel.getSize(); 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=615168&r1=615167&r2=615168&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 Fri Jan 25 02:21:15 2008
@@ -242,7 +242,7 @@
int mod = 1;
// override the specific index if it already exists
- IndexWriter writer = new IndexWriter(indexDir, ana, true);
+ IndexWriter writer = new IndexWriter(indexDir, ana, true, IndexWriter.MaxFieldLength.LIMITED);
writer.setUseCompoundFile(true); // why?
// blindly up these parameters for speed
writer.setMergeFactor( writer.getMergeFactor() * 2);
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=615168&r1=615167&r2=615168&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 Fri Jan 25 02:21:15 2008
@@ -53,7 +53,7 @@
Date start = new Date();
try {
- IndexWriter writer = new IndexWriter(INDEX_DIR, new StandardAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(INDEX_DIR, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
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=615168&r1=615167&r2=615168&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 Fri Jan 25 02:21:15 2008
@@ -68,7 +68,8 @@
deleting = true;
indexDocs(root, index, create);
}
- writer = new IndexWriter(index, new StandardAnalyzer(), create);
+ writer = new IndexWriter(index, new StandardAnalyzer(), create,
+ IndexWriter.MaxFieldLength.LIMITED);
writer.setMaxFieldLength(1000000);
indexDocs(root, index, create); // add new docs
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=615168&r1=615167&r2=615168&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 Fri Jan 25 02:21:15 2008
@@ -26,6 +26,7 @@
import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.store.AlreadyClosedException;
import org.apache.lucene.util.BitVector;
+import org.apache.lucene.util.Parameter;
import java.io.File;
import java.io.IOException;
@@ -438,6 +439,7 @@
* @param create <code>true</code> to create the index or overwrite
* the existing one; <code>false</code> to append to the existing
* index
+ * @param mfl whether or not to limit field lengths
* @throws CorruptIndexException if the index is corrupt
* @throws LockObtainFailedException if another writer
* has this index open (<code>write.lock</code> could not
@@ -447,9 +449,62 @@
* <code>false</code> or if there is any other low-level
* IO error
*/
+ public IndexWriter(String path, Analyzer a, boolean create, MaxFieldLength mfl)
+ throws CorruptIndexException, LockObtainFailedException, IOException {
+ init(FSDirectory.getDirectory(path), a, create, true, null, true, mfl.getLimit());
+ }
+
+ /**
+ * Constructs an IndexWriter for the index in <code>path</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>path</code>, replacing the index already there, if any.
+ *
+ * @param path the path to 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
+ * @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
+ * @deprecated This constructor will be removed in the 3.0 release.
+ * Use {@link #IndexWriter(String,Analyzer,boolean,MaxFieldLength)} instead.
+ */
public IndexWriter(String path, Analyzer a, boolean create)
throws CorruptIndexException, LockObtainFailedException, IOException {
- init(FSDirectory.getDirectory(path), a, create, true, null, true);
+ init(FSDirectory.getDirectory(path), a, create, true, null, true, DEFAULT_MAX_FIELD_LENGTH);
+ }
+
+ /**
+ * Constructs an IndexWriter for the index in <code>path</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>path</code>, replacing the index already there, if any.
+ *
+ * @param path the path to 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 mfl whether or not to limit field lengths
+ * @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
+ */
+ public IndexWriter(File path, Analyzer a, boolean create, MaxFieldLength mfl)
+ throws CorruptIndexException, LockObtainFailedException, IOException {
+ init(FSDirectory.getDirectory(path), a, create, true, null, true, mfl.getLimit());
}
/**
@@ -471,10 +526,38 @@
* if it does not exist and <code>create</code> is
* <code>false</code> or if there is any other low-level
* IO error
+ * @deprecated This constructor will be removed in the 3.0 release.
+ * Use {@link #IndexWriter(File,Analyzer,boolean,MaxFieldLength)} instead.
*/
public IndexWriter(File path, Analyzer a, boolean create)
throws CorruptIndexException, LockObtainFailedException, IOException {
- init(FSDirectory.getDirectory(path), a, create, true, null, true);
+ init(FSDirectory.getDirectory(path), a, create, true, null, true, DEFAULT_MAX_FIELD_LENGTH);
+ }
+
+ /**
+ * Constructs an IndexWriter 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 mfl whether or not to limit field lengths
+ * @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
+ */
+ public IndexWriter(Directory d, Analyzer a, boolean create, MaxFieldLength mfl)
+ throws CorruptIndexException, LockObtainFailedException, IOException {
+ init(d, a, create, false, null, true, mfl.getLimit());
}
/**
@@ -496,10 +579,34 @@
* if it does not exist and <code>create</code> is
* <code>false</code> or if there is any other low-level
* IO error
+ * @deprecated This constructor will be removed in the 3.0 release.
+ * Use {@link #IndexWriter(Directory,Analyzer,boolean,MaxFieldLength)} instead.
*/
public IndexWriter(Directory d, Analyzer a, boolean create)
throws CorruptIndexException, LockObtainFailedException, IOException {
- init(d, a, create, false, null, true);
+ init(d, a, create, false, null, true, DEFAULT_MAX_FIELD_LENGTH);
+ }
+
+ /**
+ * Constructs an IndexWriter for the index in
+ * <code>path</code>, first creating it if it does not
+ * already exist. Text will be analyzed with
+ * <code>a</code>.
+ *
+ * @param path the path to the index directory
+ * @param a the analyzer to use
+ * @param mfl whether or not to limit field lengths
+ * @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 there is any other low-level
+ * IO error
+ */
+ public IndexWriter(String path, Analyzer a, MaxFieldLength mfl)
+ throws CorruptIndexException, LockObtainFailedException, IOException {
+ init(FSDirectory.getDirectory(path), a, true, null, true, mfl.getLimit());
}
/**
@@ -517,10 +624,12 @@
* @throws IOException if the directory cannot be
* read/written to or if there is any other low-level
* IO error
+ * @deprecated This constructor will be removed in the 3.0 release.
+ * Use {@link #IndexWriter(String,Analyzer,MaxFieldLength)} instead.
*/
- public IndexWriter(String path, Analyzer a)
+ public IndexWriter(String path, Analyzer a)
throws CorruptIndexException, LockObtainFailedException, IOException {
- init(FSDirectory.getDirectory(path), a, true, null, true);
+ init(FSDirectory.getDirectory(path), a, true, null, true, DEFAULT_MAX_FIELD_LENGTH);
}
/**
@@ -531,6 +640,73 @@
*
* @param path the path to the index directory
* @param a the analyzer to use
+ * @param mfl whether or not to limit field lengths
+ * @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 there is any other low-level
+ * IO error
+ */
+ public IndexWriter(File path, Analyzer a, MaxFieldLength mfl)
+ throws CorruptIndexException, LockObtainFailedException, IOException {
+ init(FSDirectory.getDirectory(path), a, true, null, true, mfl.getLimit());
+ }
+
+ /**
+ * Constructs an IndexWriter for the index in
+ * <code>path</code>, first creating it if it does not
+ * already exist. Text will be analyzed with
+ * <code>a</code>.
+ *
+ * @param path the path to the index directory
+ * @param a the analyzer to use
+ * @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 there is any other low-level
+ * IO error
+ * @deprecated This constructor will be removed in the 3.0 release.
+ * Use {@link #IndexWriter(File,Analyzer,MaxFieldLength)} instead.
+ */
+ public IndexWriter(File path, Analyzer a)
+ throws CorruptIndexException, LockObtainFailedException, IOException {
+ init(FSDirectory.getDirectory(path), a, true, null, true, DEFAULT_MAX_FIELD_LENGTH);
+ }
+
+ /**
+ * Constructs an IndexWriter for the index in
+ * <code>d</code>, first creating it if it does not
+ * already exist. Text will be analyzed with
+ * <code>a</code>.
+ *
+ * @param d the index directory
+ * @param a the analyzer to use
+ * @param mfl whether or not to limit field lengths
+ * @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 there is any other low-level
+ * IO error
+ */
+ public IndexWriter(Directory d, Analyzer a, MaxFieldLength mfl)
+ throws CorruptIndexException, LockObtainFailedException, IOException {
+ init(d, a, false, null, true, mfl.getLimit());
+ }
+
+ /**
+ * Constructs an IndexWriter for the index in
+ * <code>d</code>, first creating it if it does not
+ * already exist. Text will be analyzed with
+ * <code>a</code>.
+ *
+ * @param d the index directory
+ * @param a the analyzer to use
* @throws CorruptIndexException if the index is corrupt
* @throws LockObtainFailedException if another writer
* has this index open (<code>write.lock</code> could not
@@ -538,10 +714,12 @@
* @throws IOException if the directory cannot be
* read/written to or if there is any other low-level
* IO error
+ * @deprecated This constructor will be removed in the 3.0 release.
+ * Use {@link #IndexWriter(Directory,Analyzer,MaxFieldLength)} instead.
*/
- public IndexWriter(File path, Analyzer a)
+ public IndexWriter(Directory d, Analyzer a)
throws CorruptIndexException, LockObtainFailedException, IOException {
- init(FSDirectory.getDirectory(path), a, true, null, true);
+ init(d, a, false, null, true, DEFAULT_MAX_FIELD_LENGTH);
}
/**
@@ -551,7 +729,9 @@
* <code>a</code>.
*
* @param d the index directory
+ * @param autoCommit see <a href="#autoCommit">above</a>
* @param a the analyzer to use
+ * @param mfl whether or not to limit field lengths
* @throws CorruptIndexException if the index is corrupt
* @throws LockObtainFailedException if another writer
* has this index open (<code>write.lock</code> could not
@@ -560,9 +740,9 @@
* read/written to or if there is any other low-level
* IO error
*/
- public IndexWriter(Directory d, Analyzer a)
+ public IndexWriter(Directory d, boolean autoCommit, Analyzer a, MaxFieldLength mfl)
throws CorruptIndexException, LockObtainFailedException, IOException {
- init(d, a, false, null, true);
+ init(d, a, false, null, autoCommit, mfl.getLimit());
}
/**
@@ -581,10 +761,12 @@
* @throws IOException if the directory cannot be
* read/written to or if there is any other low-level
* IO error
+ * @deprecated This constructor will be removed in the 3.0 release.
+ * Use {@link #IndexWriter(Directory,boolean,Analyzer,MaxFieldLength)} instead.
*/
- public IndexWriter(Directory d, boolean autoCommit, Analyzer a)
+ public IndexWriter(Directory d, boolean autoCommit, Analyzer a)
throws CorruptIndexException, LockObtainFailedException, IOException {
- init(d, a, false, null, autoCommit);
+ init(d, a, false, null, autoCommit, DEFAULT_MAX_FIELD_LENGTH);
}
/**
@@ -599,6 +781,7 @@
* @param create <code>true</code> to create the index or overwrite
* the existing one; <code>false</code> to append to the existing
* index
+ * @param mfl whether or not to limit field lengths
* @throws CorruptIndexException if the index is corrupt
* @throws LockObtainFailedException if another writer
* has this index open (<code>write.lock</code> could not
@@ -608,9 +791,61 @@
* <code>false</code> or if there is any other low-level
* IO error
*/
+ public IndexWriter(Directory d, boolean autoCommit, Analyzer a, boolean create, MaxFieldLength mfl)
+ throws CorruptIndexException, LockObtainFailedException, IOException {
+ init(d, a, create, false, null, autoCommit, mfl.getLimit());
+ }
+
+ /**
+ * Constructs an IndexWriter 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 autoCommit see <a href="#autoCommit">above</a>
+ * @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
+ * @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
+ * @deprecated This constructor will be removed in the 3.0 release.
+ * Use {@link #IndexWriter(Directory,boolean,Analyzer,boolean,MaxFieldLength)} instead.
+ */
public IndexWriter(Directory d, boolean autoCommit, Analyzer a, boolean create)
throws CorruptIndexException, LockObtainFailedException, IOException {
- init(d, a, create, false, null, autoCommit);
+ init(d, a, create, false, null, autoCommit, DEFAULT_MAX_FIELD_LENGTH);
+ }
+
+ /**
+ * Expert: constructs an IndexWriter with a custom {@link
+ * IndexDeletionPolicy}, for the index in <code>d</code>,
+ * first creating it if it does not already exist. Text
+ * will be analyzed with <code>a</code>.
+ *
+ * @param d the index directory
+ * @param autoCommit see <a href="#autoCommit">above</a>
+ * @param a the analyzer to use
+ * @param deletionPolicy see <a href="#deletionPolicy">above</a>
+ * @param mfl whether or not to limit field lengths
+ * @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 there is any other low-level
+ * IO error
+ */
+ public IndexWriter(Directory d, boolean autoCommit, Analyzer a, IndexDeletionPolicy deletionPolicy, MaxFieldLength mfl)
+ throws CorruptIndexException, LockObtainFailedException, IOException {
+ init(d, a, false, deletionPolicy, autoCommit, mfl.getLimit());
}
/**
@@ -630,10 +865,42 @@
* @throws IOException if the directory cannot be
* read/written to or if there is any other low-level
* IO error
+ * @deprecated This constructor will be removed in the 3.0 release.
+ * Use {@link #IndexWriter(Directory,boolean,Analyzer,IndexDeletionPolicy,MaxFieldLength)} instead.
*/
- public IndexWriter(Directory d, boolean autoCommit, Analyzer a, IndexDeletionPolicy deletionPolicy)
+ public IndexWriter(Directory d, boolean autoCommit, Analyzer a, IndexDeletionPolicy deletionPolicy)
throws CorruptIndexException, LockObtainFailedException, IOException {
- init(d, a, false, deletionPolicy, autoCommit);
+ init(d, a, false, deletionPolicy, autoCommit, DEFAULT_MAX_FIELD_LENGTH);
+ }
+
+ /**
+ * Expert: constructs an IndexWriter with a custom {@link
+ * IndexDeletionPolicy}, 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 autoCommit see <a href="#autoCommit">above</a>
+ * @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
+ * @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
+ */
+ public IndexWriter(Directory d, boolean autoCommit, Analyzer a, boolean create, IndexDeletionPolicy deletionPolicy, MaxFieldLength mfl)
+ throws CorruptIndexException, LockObtainFailedException, IOException {
+ init(d, a, create, false, deletionPolicy, autoCommit, mfl.getLimit());
}
/**
@@ -659,27 +926,30 @@
* if it does not exist and <code>create</code> is
* <code>false</code> or if there is any other low-level
* IO error
+ * @deprecated This constructor will be removed in the 3.0 release.
+ * Use {@link #IndexWriter(Directory,boolean,Analyzer,boolean,IndexDeletionPolicy,MaxFieldLength)} instead.
*/
public IndexWriter(Directory d, boolean autoCommit, Analyzer a, boolean create, IndexDeletionPolicy deletionPolicy)
- throws CorruptIndexException, LockObtainFailedException, IOException {
- init(d, a, create, false, deletionPolicy, autoCommit);
+ throws CorruptIndexException, LockObtainFailedException, IOException {
+ init(d, a, create, false, deletionPolicy, autoCommit, DEFAULT_MAX_FIELD_LENGTH);
}
- private void init(Directory d, Analyzer a, boolean closeDir, IndexDeletionPolicy deletionPolicy, boolean autoCommit)
+ private void init(Directory d, Analyzer a, boolean closeDir, IndexDeletionPolicy deletionPolicy, boolean autoCommit, int maxFieldLength)
throws CorruptIndexException, LockObtainFailedException, IOException {
if (IndexReader.indexExists(d)) {
- init(d, a, false, closeDir, deletionPolicy, autoCommit);
+ init(d, a, false, closeDir, deletionPolicy, autoCommit, maxFieldLength);
} else {
- init(d, a, true, closeDir, deletionPolicy, autoCommit);
+ init(d, a, true, closeDir, deletionPolicy, autoCommit, maxFieldLength);
}
}
- private void init(Directory d, Analyzer a, final boolean create, boolean closeDir, IndexDeletionPolicy deletionPolicy, boolean autoCommit)
+ private void init(Directory d, Analyzer a, final boolean create, boolean closeDir, IndexDeletionPolicy deletionPolicy, boolean autoCommit, int maxFieldLength)
throws CorruptIndexException, LockObtainFailedException, IOException {
this.closeDir = closeDir;
directory = d;
analyzer = a;
this.infoStream = defaultInfoStream;
+ this.maxFieldLength = maxFieldLength;
setMessageID();
if (create) {
@@ -839,7 +1109,8 @@
* 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 10,000 terms will be indexed for a field.
+ * By default, no more than {@link IndexWriter#DEFAULT_MAX_FIELD_LENGTH} terms
+ * will be indexed for a field.
*/
public void setMaxFieldLength(int maxFieldLength) {
ensureOpen();
@@ -1381,8 +1652,9 @@
* is your memory, but you should anticipate an OutOfMemoryError.<p/>
* By default, no more than 10,000 terms will be indexed for a field.
*
+ * @see MaxFieldLength
*/
- private int maxFieldLength = DEFAULT_MAX_FIELD_LENGTH;
+ private int maxFieldLength;
/**
* Adds a document to this index. If the document contains more than
@@ -3358,5 +3630,36 @@
}
return buffer.toString();
+ }
+
+ /**
+ * Specifies maximum field length in {@link IndexWriter} constructors.
+ * {@link IndexWriter#setMaxFieldLength(int)} overrides the value set by
+ * the constructor.
+ */
+ public static final class MaxFieldLength extends Parameter implements java.io.Serializable {
+
+ private int limit;
+
+ private MaxFieldLength(String name, int limit) {
+ // typesafe enum pattern, no public constructor
+ super(name);
+ this.limit = limit;
+ }
+
+ public int getLimit() {
+ return limit;
+ }
+
+ /** Sets the maximum field length to {@link Integer#MAX_VALUE}. */
+ public static final MaxFieldLength UNLIMITED
+ = new MaxFieldLength("UNLIMITED", Integer.MAX_VALUE);
+
+ /**
+ * Sets the maximum field length to
+ * {@link IndexWriter#DEFAULT_MAX_FIELD_LENGTH}
+ * */
+ public static final MaxFieldLength LIMITED
+ = new MaxFieldLength("LIMITED", DEFAULT_MAX_FIELD_LENGTH);
}
}
Modified: lucene/java/trunk/src/test/org/apache/lucene/IndexTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/IndexTest.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/IndexTest.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/IndexTest.java Fri Jan 25 02:21:15 2008
@@ -29,7 +29,7 @@
try {
Date start = new Date();
IndexWriter writer = new IndexWriter(File.createTempFile("luceneTest", "idx"),
- new SimpleAnalyzer(), true);
+ new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
writer.setMergeFactor(20);
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=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/TestDemo.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/TestDemo.java Fri Jan 25 02:21:15 2008
@@ -50,7 +50,8 @@
// parameter true will overwrite the index in that directory
// if one exists):
//Directory directory = FSDirectory.getDirectory("/tmp/testindex", true);
- IndexWriter iwriter = new IndexWriter(directory, analyzer, true);
+ IndexWriter iwriter = new IndexWriter(directory, analyzer, true,
+ IndexWriter.MaxFieldLength.LIMITED);
iwriter.setMaxFieldLength(25000);
Document doc = new Document();
String text = "This is the text to be indexed.";
Modified: lucene/java/trunk/src/test/org/apache/lucene/TestHitIterator.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/TestHitIterator.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/TestHitIterator.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/TestHitIterator.java Fri Jan 25 02:21:15 2008
@@ -40,7 +40,8 @@
public void testIterator() throws Exception {
RAMDirectory directory = new RAMDirectory();
- IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("field", "iterator test doc 1", Field.Store.YES, Field.Index.TOKENIZED));
writer.addDocument(doc);
Modified: lucene/java/trunk/src/test/org/apache/lucene/TestSearch.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/TestSearch.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/TestSearch.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/TestSearch.java Fri Jan 25 02:21:15 2008
@@ -77,7 +77,8 @@
{
Directory directory = new RAMDirectory();
Analyzer analyzer = new SimpleAnalyzer();
- IndexWriter writer = new IndexWriter(directory, analyzer, true);
+ IndexWriter writer = new IndexWriter(directory, analyzer, true,
+ IndexWriter.MaxFieldLength.LIMITED);
writer.setUseCompoundFile(useCompoundFile);
Modified: lucene/java/trunk/src/test/org/apache/lucene/TestSearchForDuplicates.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/TestSearchForDuplicates.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/TestSearchForDuplicates.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/TestSearchForDuplicates.java Fri Jan 25 02:21:15 2008
@@ -84,7 +84,8 @@
private void doTest(PrintWriter out, boolean useCompoundFiles) throws Exception {
Directory directory = new RAMDirectory();
Analyzer analyzer = new SimpleAnalyzer();
- IndexWriter writer = new IndexWriter(directory, analyzer, true);
+ IndexWriter writer = new IndexWriter(directory, analyzer, true,
+ IndexWriter.MaxFieldLength.LIMITED);
writer.setUseCompoundFile(useCompoundFiles);
Modified: lucene/java/trunk/src/test/org/apache/lucene/TestSnapshotDeletionPolicy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/TestSnapshotDeletionPolicy.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/TestSnapshotDeletionPolicy.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/TestSnapshotDeletionPolicy.java Fri Jan 25 02:21:15 2008
@@ -68,7 +68,8 @@
final long stopTime = System.currentTimeMillis() + 7000;
SnapshotDeletionPolicy dp = new SnapshotDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy());
- final IndexWriter writer = new IndexWriter(dir, true, new StandardAnalyzer(), dp);
+ final IndexWriter writer = new IndexWriter(dir, true, new StandardAnalyzer(), dp,
+ IndexWriter.MaxFieldLength.LIMITED);
// Force frequent commits
writer.setMaxBufferedDocs(2);
Modified: lucene/java/trunk/src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java Fri Jan 25 02:21:15 2008
@@ -37,7 +37,7 @@
public void testCaching() throws IOException {
Directory dir = new RAMDirectory();
- IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer());
+ IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
TokenStream stream = new TokenStream() {
private int index = 0;
Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestCheckIndex.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestCheckIndex.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestCheckIndex.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestCheckIndex.java Fri Jan 25 02:21:15 2008
@@ -33,7 +33,8 @@
public void testDeletedDocs() throws IOException {
MockRAMDirectory dir = new MockRAMDirectory();
- IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
writer.setMaxBufferedDocs(2);
Document doc = new Document();
doc.add(new Field("field", "aaa", Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestFilterIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestFilterIndexReader.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestFilterIndexReader.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestFilterIndexReader.java Fri Jan 25 02:21:15 2008
@@ -93,8 +93,8 @@
*/
public void testFilterIndexReader() throws Exception {
RAMDirectory directory = new MockRAMDirectory();
- IndexWriter writer =
- new IndexWriter(directory, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
Document d1 = new Document();
d1.add(new Field("default","one two", Field.Store.YES, Field.Index.TOKENIZED));
Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java Fri Jan 25 02:21:15 2008
@@ -2656,4 +2656,26 @@
public void testIOExceptionDuringWriteSegmentWithThreadsOnlyOnce() throws IOException {
_testMultipleThreadsFailure(new FailOnlyInWriteSegment(true));
}
+
+ // LUCENE-1084: test unlimited field length
+ public void testUnlimitedMaxFieldLength() throws IOException {
+ Directory dir = new MockRAMDirectory();
+
+ IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED);
+
+ Document doc = new Document();
+ StringBuffer b = new StringBuffer();
+ for(int i=0;i<10000;i++)
+ b.append(" a");
+ b.append(" x");
+ doc.add(new Field("field", b.toString(), Field.Store.NO, Field.Index.TOKENIZED));
+ writer.addDocument(doc);
+ writer.close();
+
+ IndexReader reader = IndexReader.open(dir);
+ Term t = new Term("field", "x");
+ assertEquals(1, reader.docFreq(t));
+ reader.close();
+ dir.close();
+ }
}
Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java Fri Jan 25 02:21:15 2008
@@ -45,7 +45,8 @@
public class TestMultiLevelSkipList extends LuceneTestCase {
public void testSimpleSkip() throws IOException {
RAMDirectory dir = new RAMDirectory();
- IndexWriter writer = new IndexWriter(dir, new PayloadAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(dir, new PayloadAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
Term term = new Term("test", "a");
for (int i = 0; i < 5000; i++) {
Document d1 = new Document();
Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestSegmentTermDocs.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestSegmentTermDocs.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestSegmentTermDocs.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestSegmentTermDocs.java Fri Jan 25 02:21:15 2008
@@ -104,7 +104,8 @@
public void testSkipTo(int indexDivisor) throws IOException {
Directory dir = new RAMDirectory();
- IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
Term ta = new Term("content","aaa");
for(int i = 0; i < 10; i++)
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/BaseTestRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/BaseTestRangeFilter.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/BaseTestRangeFilter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/BaseTestRangeFilter.java Fri Jan 25 02:21:15 2008
@@ -75,10 +75,10 @@
try {
/* build an index */
- IndexWriter writer = new IndexWriter(index,
- new SimpleAnalyzer(), T);
+ IndexWriter writer = new IndexWriter(index, new SimpleAnalyzer(), T,
+ IndexWriter.MaxFieldLength.LIMITED);
- for (int d = minId; d <= maxId; d++) {
+ for (int d = minId; d <= maxId; d++) {
Document doc = new Document();
doc.add(new Field("id",pad(d), Field.Store.YES, Field.Index.UN_TOKENIZED));
int r= rand.nextInt();
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestConstantScoreRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestConstantScoreRangeQuery.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestConstantScoreRangeQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestConstantScoreRangeQuery.java Fri Jan 25 02:21:15 2008
@@ -67,11 +67,10 @@
};
small = new RAMDirectory();
- IndexWriter writer = new IndexWriter(small,
- new WhitespaceAnalyzer(),
- true);
-
- for (int i = 0; i < data.length; i++) {
+ IndexWriter writer = new IndexWriter(small, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
+
+ for (int i = 0; i < data.length; i++) {
Document doc = new Document();
doc.add(new Field("id", String.valueOf(i), Field.Store.YES, Field.Index.UN_TOKENIZED));//Field.Keyword("id",String.valueOf(i)));
doc.add(new Field("all", "all", Field.Store.YES, Field.Index.UN_TOKENIZED));//Field.Keyword("all","all"));
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestDateSort.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestDateSort.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestDateSort.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestDateSort.java Fri Jan 25 02:21:15 2008
@@ -49,7 +49,8 @@
public void setUp() throws Exception {
// Create an index writer.
directory = new RAMDirectory();
- IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
// oldest doc:
// Add the first document. text = "Document 1" dateTime = Oct 10 03:25:22 EDT 2007
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestExplanations.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestExplanations.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestExplanations.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestExplanations.java Fri Jan 25 02:21:15 2008
@@ -64,7 +64,8 @@
public void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
- IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true);
+ IndexWriter writer= new IndexWriter(directory, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < docFields.length; i++) {
Document doc = new Document();
doc.add(new Field(FIELD, docFields[i], Field.Store.NO, Field.Index.TOKENIZED));
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestMultiSearcherRanking.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestMultiSearcherRanking.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestMultiSearcherRanking.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestMultiSearcherRanking.java Fri Jan 25 02:21:15 2008
@@ -114,11 +114,13 @@
super.setUp();
// create MultiSearcher from two seperate searchers
Directory d1 = new RAMDirectory();
- IndexWriter iw1 = new IndexWriter(d1, new StandardAnalyzer(), true);
+ IndexWriter iw1 = new IndexWriter(d1, new StandardAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
addCollection1(iw1);
iw1.close();
Directory d2 = new RAMDirectory();
- IndexWriter iw2 = new IndexWriter(d2, new StandardAnalyzer(), true);
+ IndexWriter iw2 = new IndexWriter(d2, new StandardAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
addCollection2(iw2);
iw2.close();
@@ -129,7 +131,8 @@
// create IndexSearcher which contains all documents
Directory d = new RAMDirectory();
- IndexWriter iw = new IndexWriter(d, new StandardAnalyzer(), true);
+ IndexWriter iw = new IndexWriter(d, new StandardAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
addCollection1(iw);
addCollection2(iw);
iw.close();
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestPhraseQuery.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestPhraseQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestPhraseQuery.java Fri Jan 25 02:21:15 2008
@@ -55,7 +55,8 @@
return 100;
}
};
- IndexWriter writer = new IndexWriter(directory, analyzer, true);
+ IndexWriter writer = new IndexWriter(directory, analyzer, true,
+ IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("field", "one two three four five", Field.Store.YES, Field.Index.TOKENIZED));
@@ -201,7 +202,8 @@
public void testPhraseQueryWithStopAnalyzer() throws Exception {
RAMDirectory directory = new RAMDirectory();
StopAnalyzer stopAnalyzer = new StopAnalyzer();
- IndexWriter writer = new IndexWriter(directory, stopAnalyzer, true);
+ IndexWriter writer = new IndexWriter(directory, stopAnalyzer, true,
+ IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("field", "the stop words are here", Field.Store.YES, Field.Index.TOKENIZED));
writer.addDocument(doc);
@@ -232,7 +234,8 @@
public void testPhraseQueryInConjunctionScorer() throws Exception {
RAMDirectory directory = new RAMDirectory();
- IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("source", "marketing info", Field.Store.YES, Field.Index.TOKENIZED));
@@ -267,7 +270,8 @@
searcher.close();
- writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true);
+ writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
doc = new Document();
doc.add(new Field("contents", "map entry woo", Field.Store.YES, Field.Index.TOKENIZED));
writer.addDocument(doc);
@@ -316,7 +320,8 @@
public void testSlopScoring() throws IOException {
Directory directory = new RAMDirectory();
- IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("field", "foo firstname lastname foo", Field.Store.YES, Field.Index.TOKENIZED));
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestPositionIncrement.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestPositionIncrement.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestPositionIncrement.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestPositionIncrement.java Fri Jan 25 02:21:15 2008
@@ -66,7 +66,8 @@
}
};
RAMDirectory store = new RAMDirectory();
- IndexWriter writer = new IndexWriter(store, analyzer, true);
+ IndexWriter writer = new IndexWriter(store, analyzer, true,
+ IndexWriter.MaxFieldLength.LIMITED);
Document d = new Document();
d.add(new Field("field", "bogus", Field.Store.YES, Field.Index.TOKENIZED));
writer.addDocument(d);
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java Fri Jan 25 02:21:15 2008
@@ -55,7 +55,8 @@
private static void startServer() throws Exception {
// construct an index
RAMDirectory indexStore = new RAMDirectory();
- IndexWriter writer = new IndexWriter(indexStore,new SimpleAnalyzer(),true);
+ IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("test", "test text", Field.Store.YES, Field.Index.TOKENIZED));
doc.add(new Field("type", "A", Field.Store.YES, Field.Index.TOKENIZED));
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestSimilarity.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestSimilarity.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestSimilarity.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestSimilarity.java Fri Jan 25 02:21:15 2008
@@ -51,7 +51,8 @@
public void testSimilarity() throws Exception {
RAMDirectory store = new RAMDirectory();
- IndexWriter writer = new IndexWriter(store, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(store, new SimpleAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
writer.setSimilarity(new SimpleSimilarity());
Document d1 = new Document();
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestSpanQueryFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestSpanQueryFilter.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestSpanQueryFilter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestSpanQueryFilter.java Fri Jan 25 02:21:15 2008
@@ -41,7 +41,8 @@
public void testFilterWorks() throws Exception {
Directory dir = new RAMDirectory();
- IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < 500; i++) {
Document document = new Document();
document.add(new Field("field", English.intToEnglish(i) + " equals " + English.intToEnglish(i),
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestTermVectors.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestTermVectors.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestTermVectors.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestTermVectors.java Fri Jan 25 02:21:15 2008
@@ -41,8 +41,8 @@
public void setUp() throws Exception {
super.setUp();
- IndexWriter writer
- = new IndexWriter(directory, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
//writer.setUseCompoundFile(true);
//writer.infoStream = System.out;
for (int i = 0; i < 1000; i++) {
@@ -201,7 +201,8 @@
Directory dir = new RAMDirectory();
try {
- IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
assertTrue(writer != null);
writer.addDocument(testDoc1);
writer.addDocument(testDoc2);
@@ -318,7 +319,8 @@
// Test only a few docs having vectors
public void testRareVectors() throws IOException {
- IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
for(int i=0;i<100;i++) {
Document doc = new Document();
doc.add(new Field("field", English.intToEnglish(i),
@@ -349,7 +351,8 @@
// In a single doc, for the same field, mix the term
// vectors up
public void testMixedVectrosVectors() throws IOException {
- IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
doc.add(new Field("field", "one",
Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.NO));
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/function/FunctionTestSetup.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/function/FunctionTestSetup.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/function/FunctionTestSetup.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/function/FunctionTestSetup.java Fri Jan 25 02:21:15 2008
@@ -88,7 +88,8 @@
super.setUp();
dir = new RAMDirectory();
anlzr = new StandardAnalyzer();
- IndexWriter iw = new IndexWriter(dir,anlzr);
+ IndexWriter iw = new IndexWriter(dir, anlzr,
+ IndexWriter.MaxFieldLength.LIMITED);
// add docs not exactly in natural ID order, to verify we do check the order of docs by scores
int remaining = N_DOCS;
boolean done[] = new boolean[N_DOCS];
Modified: lucene/java/trunk/src/test/org/apache/lucene/search/spans/TestBasics.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/spans/TestBasics.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/spans/TestBasics.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/spans/TestBasics.java Fri Jan 25 02:21:15 2008
@@ -50,8 +50,8 @@
public void setUp() throws Exception {
super.setUp();
RAMDirectory directory = new RAMDirectory();
- IndexWriter writer
- = new IndexWriter(directory, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
//writer.infoStream = System.out;
for (int i = 0; i < 1000; i++) {
Document doc = new Document();
Modified: lucene/java/trunk/src/test/org/apache/lucene/store/TestLockFactory.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/store/TestLockFactory.java?rev=615168&r1=615167&r2=615168&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/store/TestLockFactory.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/store/TestLockFactory.java Fri Jan 25 02:21:15 2008
@@ -49,7 +49,8 @@
// Lock prefix should have been set:
assertTrue("lock prefix was not set by the RAMDirectory", lf.lockPrefixSet);
- IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
// add 100 documents (so that commit lock is used)
for (int i = 0; i < 100; i++) {
@@ -82,13 +83,15 @@
assertTrue("RAMDirectory.setLockFactory did not take",
NoLockFactory.class.isInstance(dir.getLockFactory()));
- IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
// Create a 2nd IndexWriter. This is normally not allowed but it should run through since we're not
// using any locks:
IndexWriter writer2 = null;
try {
- writer2 = new IndexWriter(dir, new WhitespaceAnalyzer(), false);
+ writer2 = new IndexWriter(dir, new WhitespaceAnalyzer(), false,
+ IndexWriter.MaxFieldLength.LIMITED);
} catch (Exception e) {
e.printStackTrace(System.out);
fail("Should not have hit an IOException with no locking");
@@ -108,12 +111,14 @@
assertTrue("RAMDirectory did not use correct LockFactory: got " + dir.getLockFactory(),
SingleInstanceLockFactory.class.isInstance(dir.getLockFactory()));
- IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
// Create a 2nd IndexWriter. This should fail:
IndexWriter writer2 = null;
try {
- writer2 = new IndexWriter(dir, new WhitespaceAnalyzer(), false);
+ writer2 = new IndexWriter(dir, new WhitespaceAnalyzer(), false,
+ IndexWriter.MaxFieldLength.LIMITED);
fail("Should have hit an IOException with two IndexWriters on default SingleInstanceLockFactory");
} catch (IOException e) {
}
@@ -129,7 +134,8 @@
public void testDefaultFSDirectory() throws IOException {
String indexDirName = "index.TestLockFactory1";
- IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
assertTrue("FSDirectory did not use correct LockFactory: got " + writer.getDirectory().getLockFactory(),
SimpleFSLockFactory.class.isInstance(writer.getDirectory().getLockFactory()) ||
@@ -139,7 +145,8 @@
// Create a 2nd IndexWriter. This should fail:
try {
- writer2 = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), false);
+ writer2 = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), false,
+ IndexWriter.MaxFieldLength.LIMITED);
fail("Should have hit an IOException with two IndexWriters on default SimpleFSLockFactory");
} catch (IOException e) {
}
@@ -157,7 +164,8 @@
public void testFSDirectoryTwoCreates() throws IOException {
String indexDirName = "index.TestLockFactory2";
- IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
assertTrue("FSDirectory did not use correct LockFactory: got " + writer.getDirectory().getLockFactory(),
SimpleFSLockFactory.class.isInstance(writer.getDirectory().getLockFactory()) ||
@@ -180,7 +188,8 @@
// Create a 2nd IndexWriter. This should not fail:
IndexWriter writer2 = null;
try {
- writer2 = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ writer2 = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
} catch (IOException e) {
e.printStackTrace(System.out);
fail("Should not have hit an IOException with two IndexWriters with create=true, on default SimpleFSLockFactory");
@@ -213,28 +222,32 @@
// NoLockFactory:
System.setProperty(prpName, "org.apache.lucene.store.NoLockFactory");
- IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
assertTrue("FSDirectory did not use correct LockFactory: got " + writer.getDirectory().getLockFactory(),
NoLockFactory.class.isInstance(writer.getDirectory().getLockFactory()));
writer.close();
// SingleInstanceLockFactory:
System.setProperty(prpName, "org.apache.lucene.store.SingleInstanceLockFactory");
- writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
assertTrue("FSDirectory did not use correct LockFactory: got " + writer.getDirectory().getLockFactory(),
SingleInstanceLockFactory.class.isInstance(writer.getDirectory().getLockFactory()));
writer.close();
// NativeFSLockFactory:
System.setProperty(prpName, "org.apache.lucene.store.NativeFSLockFactory");
- writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
assertTrue("FSDirectory did not use correct LockFactory: got " + writer.getDirectory().getLockFactory(),
NativeFSLockFactory.class.isInstance(writer.getDirectory().getLockFactory()));
writer.close();
// SimpleFSLockFactory:
System.setProperty(prpName, "org.apache.lucene.store.SimpleFSLockFactory");
- writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
assertTrue("FSDirectory did not use correct LockFactory: got " + writer.getDirectory().getLockFactory(),
SimpleFSLockFactory.class.isInstance(writer.getDirectory().getLockFactory()));
writer.close();
@@ -254,7 +267,8 @@
assertTrue("Locks are already disabled", !FSDirectory.getDisableLocks());
FSDirectory.setDisableLocks(true);
- IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
assertTrue("FSDirectory did not use correct default LockFactory: got " + writer.getDirectory().getLockFactory(),
NoLockFactory.class.isInstance(writer.getDirectory().getLockFactory()));
@@ -262,7 +276,8 @@
// Should be no error since locking is disabled:
IndexWriter writer2 = null;
try {
- writer2 = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), false);
+ writer2 = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), false,
+ IndexWriter.MaxFieldLength.LIMITED);
} catch (IOException e) {
e.printStackTrace(System.out);
fail("Should not have hit an IOException with locking disabled");
@@ -328,7 +343,8 @@
FSDirectory fs1 = FSDirectory.getDirectory(indexDirName, lockFactory);
// First create a 1 doc index:
- IndexWriter w = new IndexWriter(fs1, new WhitespaceAnalyzer(), true);
+ IndexWriter w = new IndexWriter(fs1, new WhitespaceAnalyzer(), true,
+ IndexWriter.MaxFieldLength.LIMITED);
addDoc(w);
w.close();
@@ -418,7 +434,8 @@
IndexWriter writer = null;
for(int i=0;i<this.numIteration;i++) {
try {
- writer = new IndexWriter(dir, analyzer, false);
+ writer = new IndexWriter(dir, analyzer, false,
+ IndexWriter.MaxFieldLength.LIMITED);
} catch (IOException e) {
if (e.toString().indexOf(" timed out:") == -1) {
hitException = true;