LUCENE-1084: fix more test cases to use user-defined MaxFieldLength ctor for IndexWriter

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@619637 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2008-02-07 21:07:35 +00:00
parent 9a186ed521
commit fc4bc1f5af
5 changed files with 5 additions and 10 deletions

View File

@ -385,8 +385,7 @@ public class MemoryIndexTest extends TestCase {
RAMDirectory dir = new RAMDirectory();
IndexWriter writer = null;
try {
writer = new IndexWriter(dir, analyzer, true);
writer.setMaxFieldLength(Integer.MAX_VALUE);
writer = new IndexWriter(dir, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);
writer.addDocument(doc);
writer.optimize();
return dir;

View File

@ -69,8 +69,7 @@ public class IndexHTML {
indexDocs(root, index, create);
}
writer = new IndexWriter(index, new StandardAnalyzer(), create,
IndexWriter.MaxFieldLength.LIMITED);
writer.setMaxFieldLength(1000000);
new IndexWriter.MaxFieldLength(1000000));
indexDocs(root, index, create); // add new docs
System.out.println("Optimizing index...");

View File

@ -201,7 +201,7 @@ public class IndexModifier {
indexReader.close();
indexReader = null;
}
indexWriter = new IndexWriter(directory, analyzer, false, IndexWriter.MaxFieldLength.LIMITED);
indexWriter = new IndexWriter(directory, analyzer, false, new IndexWriter.MaxFieldLength(maxFieldLength));
// IndexModifier cannot use ConcurrentMergeScheduler
// because it synchronizes on the directory which can
// cause deadlock
@ -210,7 +210,6 @@ public class IndexModifier {
indexWriter.setUseCompoundFile(useCompoundFile);
if (maxBufferedDocs != IndexWriter.DISABLE_AUTO_FLUSH)
indexWriter.setMaxBufferedDocs(maxBufferedDocs);
indexWriter.setMaxFieldLength(maxFieldLength);
indexWriter.setMergeFactor(mergeFactor);
}
}

View File

@ -51,8 +51,7 @@ public class TestDemo extends LuceneTestCase {
// if one exists):
//Directory directory = FSDirectory.getDirectory("/tmp/testindex", true);
IndexWriter iwriter = new IndexWriter(directory, analyzer, true,
IndexWriter.MaxFieldLength.LIMITED);
iwriter.setMaxFieldLength(25000);
new IndexWriter.MaxFieldLength(25000));
Document doc = new Document();
String text = "This is the text to be indexed.";
doc.add(new Field("fieldname", text, Field.Store.YES,

View File

@ -1478,9 +1478,8 @@ public class TestIndexWriter extends LuceneTestCase
public void testHighFreqTerm() throws IOException {
RAMDirectory dir = new RAMDirectory();
IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, new IndexWriter.MaxFieldLength(100000000));
writer.setRAMBufferSizeMB(0.01);
writer.setMaxFieldLength(100000000);
// Massive doc that has 128 K a's
StringBuffer b = new StringBuffer(1024*1024);
for(int i=0;i<4096;i++) {