Apache Lucene open-source search software
some javadocs and comments improvements
Shai Erera756892f0373a
diff --git a/lucene/core/src/java/org/apache/lucene/index/BufferedDeletes.java b/lucene/core/src/java/org/apache/lucene/index/BufferedDeletes.javaindex afd1eef9996..a538dd1760c 100644--- a/lucene/core/src/java/org/apache/lucene/index/BufferedDeletes.java+++ b/lucene/core/src/java/org/apache/lucene/index/BufferedDeletes.java@@ -33,9 +33,9 @@ import org.apache.lucene.util.RamUsageEstimator;* deletes are pushed (on flush in DocumentsWriter), these* deletes are converted to a FrozenDeletes instance. */-// NOTE: we are sync'd by BufferedDeletes, ie, all access to-// instances of this class is via sync'd methods on-// BufferedDeletes+// NOTE: instances of this class are accessed either via a private+// instance on DocumentWriterPerThread, or via sync'd code by+// DocumentsWriterDeleteQueueclass BufferedDeletes {@@ -136,6 +136,9 @@ class BufferedDeletes {}terms.put(term, Integer.valueOf(docIDUpto));+ // note that if current != null then it means there's already a buffered+ // delete on that term, therefore we seem to over-count. this over-counting+ // is done to respect IndexWriterConfig.setMaxBufferedDeleteTerms.numTermDeletes.incrementAndGet();if (current == null) {bytesUsed.addAndGet(BYTES_PER_DEL_TERM + term.bytes.length + (RamUsageEstimator.NUM_BYTES_CHAR * term.field().length()));diff --git a/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java b/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.javaindex 84f50e8b489..f9d3d1abf96 100644--- a/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java+++ b/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java@@ -403,8 +403,8 @@ class DocumentsWriterPerThread {++numDocsInRAM;}- // Buffer a specific docID for deletion. Currently only- // used when we hit a exception when adding a document+ // Buffer a specific docID for deletion. Currently only+ // used when we hit an exception when adding a documentvoid deleteDocID(int docIDUpto) {pendingDeletes.addDocID(docIDUpto);// NOTE: we do not trigger flush here. This isdiff --git a/lucene/core/src/java/org/apache/lucene/index/FlushByRamOrCountsPolicy.java b/lucene/core/src/java/org/apache/lucene/index/FlushByRamOrCountsPolicy.javaindex fbb87d8ae40..4e2cc362785 100644--- a/lucene/core/src/java/org/apache/lucene/index/FlushByRamOrCountsPolicy.java+++ b/lucene/core/src/java/org/apache/lucene/index/FlushByRamOrCountsPolicy.java@@ -20,23 +20,32 @@ package org.apache.lucene.index;import org.apache.lucene.index.DocumentsWriterPerThreadPool.ThreadState;/**- * Default {@link FlushPolicy} implementation that flushes based on RAM used,- * document count and number of buffered deletes depending on the IndexWriter's- * {@link IndexWriterConfig}.+ * Default {@link FlushPolicy} implementation that flushes new segments based on+ * RAM used and document count depending on the IndexWriter's+ * {@link IndexWriterConfig}. It also applies pending deletes based on the+ * number of buffered delete terms.** <ul>- * <li>{@link #onDelete(DocumentsWriterFlushControl, DocumentsWriterPerThreadPool.ThreadState)} - flushes- * based on the global number of buffered delete terms iff- * {@link IndexWriterConfig#getMaxBufferedDeleteTerms()} is enabled</li>- * <li>{@link #onInsert(DocumentsWriterFlushControl, DocumentsWriterPerThreadPool.ThreadState)} - flushes- * either on the number of documents per {@link DocumentsWriterPerThread} (+ * <li>+ * {@link #onDelete(DocumentsWriterFlushControl, DocumentsWriterPerThreadPool.ThreadState)}+ * - applies pending delete operations based on the global number of buffered+ * delete terms iff {@link IndexWriterConfig#getMaxBufferedDeleteTerms()} is+ * enabled</li>+ * <li>+ * {@link #onInsert(DocumentsWriterFlushControl, DocumentsWriterPerThreadPool.ThreadState)}+ * - flushes either on the number of documents per+ * {@link DocumentsWriterPerThread} (* {@link DocumentsWriterPerThread#getNumDocsInRAM()}) or on the global active* memory consumption in the current indexing session iff* {@link IndexWriterConfig#getMaxBufferedDocs()} or* {@link IndexWriterConfig#getRAMBufferSizeMB()} is enabled respectively</li>- * <li>{@link #onUpdate(DocumentsWriterFlushControl, DocumentsWriterPerThreadPool.ThreadState)} - calls- * {@link #onInsert(DocumentsWriterFlushControl, DocumentsWriterPerThreadPool.ThreadState)} and- * {@link #onDelete(DocumentsWriterFlushControl, DocumentsWriterPerThreadPool.ThreadState)} in order</li>+ * <li>+ * {@link #onUpdate(DocumentsWriterFlushControl, DocumentsWriterPerThreadPool.ThreadState)}+ * - calls+ * {@link #onInsert(DocumentsWriterFlushControl, DocumentsWriterPerThreadPool.ThreadState)}+ * and+ * {@link #onDelete(DocumentsWriterFlushControl, DocumentsWriterPerThreadPool.ThreadState)}+ * in order</li>* </ul>* All {@link IndexWriterConfig} settings are used to mark* {@link DocumentsWriterPerThread} as flush pending during indexing withdiff --git a/lucene/core/src/java/org/apache/lucene/index/FlushPolicy.java b/lucene/core/src/java/org/apache/lucene/index/FlushPolicy.javaindex 9645479b4bf..03f6b9fd32d 100644--- a/lucene/core/src/java/org/apache/lucene/index/FlushPolicy.java+++ b/lucene/core/src/java/org/apache/lucene/index/FlushPolicy.java@@ -32,18 +32,19 @@ import org.apache.lucene.util.SetOnce;* {@link IndexWriterConfig#setRAMBufferSizeMB(double)}</li>* <li>Number of RAM resident documents - configured via* {@link IndexWriterConfig#setMaxBufferedDocs(int)}</li>- * <li>Number of buffered delete terms/queries - configured via- * {@link IndexWriterConfig#setMaxBufferedDeleteTerms(int)}</li>* </ul>- *- * The {@link IndexWriter} consults a provided {@link FlushPolicy} to control the- * flushing process. The policy is informed for each added or- * updated document as well as for each delete term. Based on the- * {@link FlushPolicy}, the information provided via {@link ThreadState} and+ * The policy also applies pending delete operations (by term and/or query),+ * given the threshold set in+ * {@link IndexWriterConfig#setMaxBufferedDeleteTerms(int)}.+ * <p>+ * {@link IndexWriter} consults the provided {@link FlushPolicy} to control the+ * flushing process. The policy is informed for each added or updated document+ * as well as for each delete term. Based on the {@link FlushPolicy}, the+ * information provided via {@link ThreadState} and* {@link DocumentsWriterFlushControl}, the {@link FlushPolicy} decides if a- * {@link DocumentsWriterPerThread} needs flushing and mark it as- * flush-pending via- * {@link DocumentsWriterFlushControl#setFlushPending(DocumentsWriterPerThreadPool.ThreadState)}.+ * {@link DocumentsWriterPerThread} needs flushing and mark it as flush-pending+ * via {@link DocumentsWriterFlushControl#setFlushPending}, or if deletes need+ * to be applied.** @see ThreadState* @see DocumentsWriterFlushControldiff --git a/lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.java b/lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.javaindex 64eca6e3fc9..23e1cf28869 100644--- a/lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.java+++ b/lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.java@@ -160,8 +160,9 @@ public class LiveIndexWriterConfig {}/**- * Determines the minimal number of delete terms required before the buffered- * in-memory delete terms and queries are applied and flushed.+ * Determines the maximum number of delete-by-term operations that will be+ * buffered before both the buffered in-memory delete terms and queries are+ * applied and flushed.* <p>* Disabled by default (writer flushes by RAM usage).* <p>@@ -169,7 +170,8 @@ public class LiveIndexWriterConfig {** <p>* Takes effect immediately, but only the next time a document is added,- * updated or deleted.+ * updated or deleted. Also, if you only delete-by-query, this setting has no+ * effect, i.e. delete queries are buffered until the next segment is flushed.** @throws IllegalArgumentException* if maxBufferedDeleteTerms is enabled but smaller than 1diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentWriteState.java b/lucene/core/src/java/org/apache/lucene/index/SegmentWriteState.javaindex a058e93938c..7caf0128fb1 100644--- a/lucene/core/src/java/org/apache/lucene/index/SegmentWriteState.java+++ b/lucene/core/src/java/org/apache/lucene/index/SegmentWriteState.java@@ -83,9 +83,7 @@ public class SegmentWriteState {this.context = context;}- /**- * Create a shallow {@link SegmentWriteState} copy final a format ID- */+ /** Create a shallow copy of {@link SegmentWriteState} with a new segment suffix. */public SegmentWriteState(SegmentWriteState state, String segmentSuffix) {infoStream = state.infoStream;directory = state.directory;