OneMerge

open class OneMerge

OneMerge provides the information necessary to perform an individual primitive merge operation, resulting in a single new segment. The merge spec includes the subset of segments to be merged as well as whether the new segment should use the compound file format.

Constructors

Link copied to clipboard
constructor(segments: MutableList<SegmentCommitInfo>)

Sole constructor.

constructor(vararg codecReaders: CodecReader)

Create a OneMerge directly from CodecReaders. Used to merge incoming readers in . This OneMerge works directly on readers and has an empty segments list.

Properties

Link copied to clipboard
Link copied to clipboard

Estimated size in bytes of the merged segment.

Link copied to clipboard

Record that an exception occurred while executing this merge

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val mergeCompleted: CompletableDeferred<Boolean>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Control used to pause/stop/resume the merge thread.

Link copied to clipboard

Returns the merge readers or an empty list if the readers were not initialized yet.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Segments to be merged.

Link copied to clipboard
Link copied to clipboard

Total number of documents in segments to be merged, not accounting for deletions.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
suspend fun await(timeout: Long, timeUnit: TimeUnit): Boolean

Waits for this merge to be completed

Link copied to clipboard

Checks if merge has been aborted and throws a merge exception if so.

Link copied to clipboard
fun close(success: Boolean, segmentDropped: Boolean, readerConsumer: IOConsumer<MergePolicy.MergeReader>)

Closes this merge and releases all merge readers

Link copied to clipboard
fun debugPhaseElapsedMs(nowNanos: Long = System.nanoTime()): Long
Link copied to clipboard

Returns true if the merge completed successfully or false if the merge succeeded with a failure. This method will not block and return an empty Optional if the merge has not finished yet

Link copied to clipboard

Returns true if the merge has finished or false if it's still running or has not been started. This method will not block.

Link copied to clipboard

Sets the merge readers for this merge.

Link copied to clipboard
Link copied to clipboard
open fun mergeFinished(success: Boolean, segmentDropped: Boolean)

Called by IndexWriter after the merge is done and all readers have been closed.

Link copied to clipboard
suspend fun mergeInit()

Called by IndexWriter after the merge started and from the thread that will be executing the merge.

Link copied to clipboard
open fun onMergeComplete()

Called just before the merge is applied to IndexWriter's SegmentInfos

Link copied to clipboard
open fun reorder(reader: CodecReader, dir: Directory, executor: Executor): Sorter.DocMap?

Extend this method if you wish to renumber doc IDs. This method will be called when index sorting is disabled on a merged view of the OneMerge. A null return value indicates that doc IDs should not be reordered.

Link copied to clipboard

Returns a readable description of the current merge state.

Link copied to clipboard
suspend fun setAborted()

Marks this merge as aborted. The merge thread should terminate at the soonest possible moment.

Link copied to clipboard

Expert: Sets the SegmentCommitInfo of the merged segment. Allows sub-classes to e.g. add diagnostic properties.

Link copied to clipboard

Returns the total size in bytes of this merge. Note that this does not indicate the size of the merged segment, but the input total size. This is only set once the merge is initialized by IndexWriter.

Link copied to clipboard

Returns the total number of documents that are included with this merge. Note that this does not indicate the number of documents after the merge.

Link copied to clipboard

Wrap a reader prior to merging in order to add/remove fields or documents.