Package org.apache.lucene.index
Class MergePolicy.OneMerge
java.lang.Object
org.apache.lucene.index.MergePolicy.OneMerge
- Enclosing class:
- MergePolicy
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.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Field Summary
Modifier and TypeFieldDescriptionlong
Estimated size in bytes of the merged segment.final List<SegmentCommitInfo>
Segments to be merged. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks if merge has been aborted and throws a merge exception if so.Returns theSegmentCommitInfo
for the merged segment, or null if it hasn't been set yet.Returns aMergePolicy.OneMergeProgress
instance for this merge, which provides statistics of the merge threads (run time vs.ReturnMergeInfo
describing this merge.boolean
Returns true if this merge was or should be aborted.void
mergeFinished
(boolean success, boolean segmentDropped) Called byIndexWriter
after the merge is done and all readers have been closed.void
Called byIndexWriter
after the merge started and from the thread that will be executing the merge.Returns a readable description of the current merge state.void
Marks this merge as aborted.void
Expert: Sets theSegmentCommitInfo
of the merged segment.long
Returns the total size in bytes of this merge.int
Returns the total number of documents that are included with this merge.wrapForMerge
(CodecReader reader) Wrap the reader in order to add/remove information to the merged segment.
-
Field Details
-
estimatedMergeBytes
public volatile long estimatedMergeBytesEstimated size in bytes of the merged segment. -
segments
Segments to be merged.
-
-
Constructor Details
-
OneMerge
Sole constructor.- Parameters:
segments
- List ofSegmentCommitInfo
s to be merged.
-
-
Method Details
-
mergeInit
Called byIndexWriter
after the merge started and from the thread that will be executing the merge.- Throws:
IOException
-
mergeFinished
Called byIndexWriter
after the merge is done and all readers have been closed.- Parameters:
success
- true iff the merge finished successfully ie. was committedsegmentDropped
- true iff the merged segment was dropped since it was fully deleted- Throws:
IOException
-
wrapForMerge
Wrap the reader in order to add/remove information to the merged segment.- Throws:
IOException
-
setMergeInfo
Expert: Sets theSegmentCommitInfo
of the merged segment. Allows sub-classes to e.g.add diagnostic
properties. -
getMergeInfo
Returns theSegmentCommitInfo
for the merged segment, or null if it hasn't been set yet. -
segString
Returns a readable description of the current merge state. -
totalBytesSize
public long totalBytesSize()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. -
totalNumDocs
public int totalNumDocs()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. -
getStoreMergeInfo
ReturnMergeInfo
describing this merge. -
isAborted
public boolean isAborted()Returns true if this merge was or should be aborted. -
setAborted
public void setAborted()Marks this merge as aborted. The merge thread should terminate at the soonest possible moment. -
checkAborted
Checks if merge has been aborted and throws a merge exception if so. -
getMergeProgress
Returns aMergePolicy.OneMergeProgress
instance for this merge, which provides statistics of the merge threads (run time vs. sleep time) if merging is throttled.
-