MergePolicy.MergeContext (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.index, class: MergePolicy, interface: MergeContext

Package org.apache.lucene.index

# Interface MergePolicy.MergeContext

All Known Implementing Classes:
  `IndexWriter`

Enclosing class:
  `MergePolicy`

public static interface MergePolicy.MergeContext
This interface represents the current context of the merge selection process. It allows to access real-time information like the currently merging segments or how many deletes a segment would claim back if merged. This context might be stateful and change during the execution of a merge policy's selection processes.

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `InfoStream`
  `getInfoStream()`
  Returns the info stream that can be used to log messages
  `Set<SegmentCommitInfo>`
  `getMergingSegments()`
  Returns an unmodifiable set of segments that are currently merging.
  `int`
  `numDeletedDocs(SegmentCommitInfo info)`
  Returns the number of deleted documents in the given segments.
  `int`
  `numDeletesToMerge(SegmentCommitInfo info)`
  Returns the number of deletes a merge would claim back if the given segment is merged.

- ## Method Details

  - ### numDeletesToMerge

    int numDeletesToMerge(SegmentCommitInfo info) throws IOException
    Returns the number of deletes a merge would claim back if the given segment is merged.
    Parameters:
      `info` - the segment to get the number of deletes for
    Throws:
      `IOException`
    See Also:
      - `MergePolicy.numDeletesToMerge(SegmentCommitInfo, int, org.apache.lucene.util.IOSupplier)`

  - ### numDeletedDocs

    int numDeletedDocs(SegmentCommitInfo info)
    Returns the number of deleted documents in the given segments.

  - ### getInfoStream

    InfoStream getInfoStream()
    Returns the info stream that can be used to log messages

  - ### getMergingSegments

    Set<SegmentCommitInfo> getMergingSegments()
    Returns an unmodifiable set of segments that are currently merging.