java.lang.Object
org.apache.lucene.index.FlushPolicy
org.apache.lucene.index.FlushByRamOrCountsPolicy
Default
FlushPolicy implementation that flushes new segments based on RAM used and
document count depending on the IndexWriter's IndexWriterConfig. It also applies pending
deletes based on the number of buffered delete terms.
onDelete(DocumentsWriterFlushControl, DocumentsWriterPerThread)- applies pending delete operations based on the global number of buffered delete terms if the consumed memory is greater thanIndexWriterConfig.getRAMBufferSizeMB().onInsert(DocumentsWriterFlushControl, DocumentsWriterPerThread)- flushes either on the number of documents perDocumentsWriterPerThread(DocumentsWriterPerThread.getNumDocsInRAM()) or on the global active memory consumption in the current indexing session iffIndexWriterConfig.getMaxBufferedDocs()orIndexWriterConfig.getRAMBufferSizeMB()is enabled respectivelyFlushPolicy.onUpdate(DocumentsWriterFlushControl, DocumentsWriterPerThread)- callsonInsert(DocumentsWriterFlushControl, DocumentsWriterPerThread)andonDelete(DocumentsWriterFlushControl, DocumentsWriterPerThread)in order
IndexWriterConfig settings are used to mark DocumentsWriterPerThread as flush
pending during indexing with respect to their live updates.
If IndexWriterConfig.setRAMBufferSizeMB(double) is enabled, the largest ram consuming
DocumentsWriterPerThread will be marked as pending iff the global active RAM consumption
is >= the configured max RAM buffer.
-
Field Summary
Fields inherited from class org.apache.lucene.index.FlushPolicy
indexWriterConfig, infoStream -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanReturnstrueif thisFlushPolicyflushes onIndexWriterConfig.getMaxBufferedDocs(), otherwisefalse.protected booleanReturnstrueif thisFlushPolicyflushes onIndexWriterConfig.getRAMBufferSizeMB(), otherwisefalse.protected voidmarkLargestWriterPending(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread) Marks the most ram consuming activeDocumentsWriterPerThreadflush pendingvoidonDelete(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread) Called for each delete term.voidonInsert(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread) Called for each document addition on the givenDocumentsWriterPerThreadsDocumentsWriterPerThread.Methods inherited from class org.apache.lucene.index.FlushPolicy
findLargestNonPendingWriter, init, onUpdate
-
Constructor Details
-
FlushByRamOrCountsPolicy
FlushByRamOrCountsPolicy()
-
-
Method Details
-
onDelete
Description copied from class:FlushPolicyCalled for each delete term. If this is a delete triggered due to an update the givenDocumentsWriterPerThreadis non-null.Note: This method is called synchronized on the given
DocumentsWriterFlushControland it is guaranteed that the calling thread holds the lock on the givenDocumentsWriterPerThread- Specified by:
onDeletein classFlushPolicy
-
onInsert
Description copied from class:FlushPolicyCalled for each document addition on the givenDocumentsWriterPerThreadsDocumentsWriterPerThread.Note: This method is synchronized by the given
DocumentsWriterFlushControland it is guaranteed that the calling thread holds the lock on the givenDocumentsWriterPerThread- Specified by:
onInsertin classFlushPolicy
-
markLargestWriterPending
protected void markLargestWriterPending(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread) Marks the most ram consuming activeDocumentsWriterPerThreadflush pending -
flushOnDocCount
protected boolean flushOnDocCount()Returnstrueif thisFlushPolicyflushes onIndexWriterConfig.getMaxBufferedDocs(), otherwisefalse. -
flushOnRAM
protected boolean flushOnRAM()Returnstrueif thisFlushPolicyflushes onIndexWriterConfig.getRAMBufferSizeMB(), otherwisefalse.
-