org.apache.lucene.index

## Class MergePolicy.OneMerge

- java.lang.Object
- - org.apache.lucene.index.MergePolicy.OneMerge

Enclosing class:
  MergePolicy

    public static class MergePolicy.OneMerge
    extends Object

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.

### Field Summary

Fields
`long` `estimatedMergeBytes` Estimated size in bytes of the merged segment.
`List<SegmentInfoPerCommit>` `segments` Segments to be merged.
`int` `totalDocCount` Number of documents in the merged segment.

### Constructor Summary

Constructors
Constructor and Description
`MergePolicy.OneMerge(List<SegmentInfoPerCommit> segments)` Sole constructor.

### Method Summary

Methods
`void` `checkAborted(Directory dir)` Called periodically by `IndexWriter` while merging to see if the merge is aborted.
`MergeInfo` `getMergeInfo()` Return `MergeInfo` describing this merge.
`boolean` `getPause()` Returns true if this merge is paused.
`String` `segString(Directory dir)` Returns a readable description of the current merge state.
`void` `setPause(boolean paused)` Set or clear whether this merge is paused paused (for example `ConcurrentMergeScheduler` will pause merges if too many are running).
`long` `totalBytesSize()` Returns the total size in bytes of this merge.
`int` `totalNumDocs()` Returns the total number of documents that are included with this merge.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### estimatedMergeBytes

    public volatile long estimatedMergeBytes

Estimated size in bytes of the merged segment.

#### segments

    public final List<SegmentInfoPerCommit> segments

Segments to be merged.

#### totalDocCount

    public final int totalDocCount

Number of documents in the merged segment.

### Constructor Detail

#### MergePolicy.OneMerge

    public MergePolicy.OneMerge(List<SegmentInfoPerCommit> segments)

Sole constructor.

Parameters:
  `segments` - List of `SegmentInfoPerCommit`s to be merged.

### Method Detail

#### checkAborted

    public void checkAborted(Directory dir)
                      throws MergePolicy.MergeAbortedException

Called periodically by `IndexWriter` while merging to see if the merge is aborted.

Throws:
  `MergePolicy.MergeAbortedException`

#### setPause

    public void setPause(boolean paused)

Set or clear whether this merge is paused paused (for example `ConcurrentMergeScheduler` will pause merges if too many are running).

#### getPause

    public boolean getPause()

Returns true if this merge is paused.

See Also:
  `setPause(boolean)`

#### segString

    public String segString(Directory dir)

Returns a readable description of the current merge state.

#### totalBytesSize

    public long totalBytesSize()
                        throws IOException

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.

Throws:
  `IOException`

#### totalNumDocs

    public int totalNumDocs()
                     throws IOException

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.

Throws:
  `IOException`

#### getMergeInfo

    public MergeInfo getMergeInfo()

Return `MergeInfo` describing this merge.