CompositeReaderContext (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.index, class: CompositeReaderContext

Package org.apache.lucene.index

# Class CompositeReaderContext

java.lang.Object
org.apache.lucene.index.IndexReaderContext
org.apache.lucene.index.CompositeReaderContext

public final class CompositeReaderContext extends IndexReaderContext
`IndexReaderContext` for `CompositeReader` instance.

- ## Field Summary

  ### Fields inherited from class org.apache.lucene.index.IndexReaderContext

  `docBaseInParent, isTopLevel, ordInParent, parent`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<IndexReaderContext>`
  `children()`
  Returns the context's children iff this context is a composite context otherwise `null` .
  `List<LeafReaderContext>`
  `leaves()`
  Returns the context's leaves if this context is a top-level context.
  `CompositeReader`
  `reader()`
  Returns the `IndexReader`, this context represents.

  ### Methods inherited from class org.apache.lucene.index.IndexReaderContext

  `id`

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

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

- ## Method Details

  - ### leaves

    public List<LeafReaderContext> leaves() throws UnsupportedOperationException
    Description copied from class: `IndexReaderContext`
    Returns the context's leaves if this context is a top-level context. For convenience, if this is an `LeafReaderContext` this returns itself as the only leaf, and it will never return a null value.

    Note: this is convenience method since leaves can always be obtained by walking the context tree using `IndexReaderContext.children()`.

    Specified by:
      `leaves` in class `IndexReaderContext`
    Throws:
      `UnsupportedOperationException` - if this is not a top-level context.
    See Also:
      - `IndexReaderContext.children()`

  - ### children

    public List<IndexReaderContext> children()
    Description copied from class: `IndexReaderContext`
    Returns the context's children iff this context is a composite context otherwise `null` .
    Specified by:
      `children` in class `IndexReaderContext`

  - ### reader

    public CompositeReader reader()
    Description copied from class: `IndexReaderContext`
    Returns the `IndexReader`, this context represents.
    Specified by:
      `reader` in class `IndexReaderContext`