Index: lucene/src/java/org/apache/lucene/index/IndexWriter.java =================================================================== --- lucene/src/java/org/apache/lucene/index/IndexWriter.java (revision 1041020) +++ lucene/src/java/org/apache/lucene/index/IndexWriter.java (working copy) @@ -50,13 +50,13 @@ An IndexWriter creates and maintains an index.

The create argument to the {@link - #IndexWriter(Directory, Analyzer, boolean, MaxFieldLength) constructor} determines + #IndexWriter(Directory, IndexWriterConfig) constructor} determines whether a new index is created, or whether an existing index is opened. Note that you can open an index with create=true even while readers are using the index. The old readers will continue to search the "point in time" snapshot they had opened, and won't see the newly created index until they re-open. There are - also {@link #IndexWriter(Directory, Analyzer, MaxFieldLength) constructors} + also {@link #IndexWriter(Directory, IndexWriterConfig) constructors} with no create argument which will create a new index if there is not already an index at the provided path and otherwise open the existing index.

@@ -72,11 +72,11 @@

These changes are buffered in memory and periodically flushed to the {@link Directory} (during the above method calls). A flush is triggered when there are enough - buffered deletes (see {@link #setMaxBufferedDeleteTerms}) + buffered deletes (see {@link IndexWriterConfig#setMaxBufferedDeleteTerms}) or enough added documents since the last flush, whichever is sooner. For the added documents, flushing is triggered either by RAM usage of the documents (see {@link - #setRAMBufferSizeMB}) or the number of added documents. + IndexWriterConfig#setRAMBufferSizeMB}) or the number of added documents. The default is to flush when RAM usage hits 16 MB. For best indexing speed you should flush by RAM usage with a large RAM buffer. Note that flushing just moves the @@ -1248,8 +1248,8 @@ /** * Adds a document to this index. If the document contains more than - * {@link #setMaxFieldLength(int)} terms for a given field, the remainder are - * discarded. + * {@link IndexWriterConfig#setMaxFieldLength(int)} terms for a given field, + * the remainder are discarded. * *

Note that if an Exception is hit (for example disk full) * then the index will be consistent, but this document @@ -1297,7 +1297,7 @@ /** * Adds a document to this index, using the provided analyzer instead of the * value of {@link #getAnalyzer()}. If the document contains more than - * {@link #setMaxFieldLength(int)} terms for a given field, the remainder are + * {@link IndexWriterConfig#setMaxFieldLength(int)} terms for a given field, the remainder are * discarded. * *

See {@link #addDocument(Document)} for details on @@ -1603,7 +1603,7 @@ * * @throws CorruptIndexException if the index is corrupt * @throws IOException if there is a low-level IO error - * @see LogMergePolicy#findMergesForOptimize + * @see MergePolicy#findMergesForOptimize */ public void optimize() throws CorruptIndexException, IOException { optimize(true); @@ -2309,7 +2309,7 @@ } // Now create the compound file if needed - if (mergePolicy instanceof LogMergePolicy && ((LogMergePolicy) mergePolicy).getUseCompoundFile()) { + if (mergePolicy.useCompoundFile(segmentInfos, info)) { List files = null;