FilterMatchesIterator (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.search, class: FilterMatchesIterator

Package org.apache.lucene.search

# Class FilterMatchesIterator

java.lang.Object
org.apache.lucene.search.FilterMatchesIterator

All Implemented Interfaces:
  `MatchesIterator`

public abstract class FilterMatchesIterator extends Object implements MatchesIterator
A MatchesIterator that delegates all calls to another MatchesIterator

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final MatchesIterator`
  `in`
  The delegate

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `FilterMatchesIterator(MatchesIterator in)`
  Create a new FilterMatchesIterator

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `endOffset()`
  The ending offset of the current match, or `-1` if offsets are not available
  `int`
  `endPosition()`
  The end position of the current match, or `-1` if positions are not available
  `Query`
  `getQuery()`
  Returns the Query causing the current match
  `MatchesIterator`
  `getSubMatches()`
  Returns a MatchesIterator that iterates over the positions and offsets of individual terms within the current match
  `boolean`
  `next()`
  Advance the iterator to the next match position
  `int`
  `startOffset()`
  The starting offset of the current match, or `-1` if offsets are not available
  `int`
  `startPosition()`
  The start position of the current match, or `-1` if positions are not available

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

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

- ## Field Details

  - ### in

    protected final MatchesIterator in
    The delegate

- ## Constructor Details

  - ### FilterMatchesIterator

    protected FilterMatchesIterator(MatchesIterator in)
    Create a new FilterMatchesIterator
    Parameters:
      `in` - the delegate

- ## Method Details

  - ### next

    public boolean next() throws IOException
    Description copied from interface: `MatchesIterator`
    Advance the iterator to the next match position
    Specified by:
      `next` in interface `MatchesIterator`
    Returns:
      `true` if matches have not been exhausted
    Throws:
      `IOException`

  - ### startPosition

    public int startPosition()
    Description copied from interface: `MatchesIterator`
    The start position of the current match, or `-1` if positions are not available

    Should only be called after `MatchesIterator.next()` has returned `true`

    Specified by:
      `startPosition` in interface `MatchesIterator`

  - ### endPosition

    public int endPosition()
    Description copied from interface: `MatchesIterator`
    The end position of the current match, or `-1` if positions are not available

    Should only be called after `MatchesIterator.next()` has returned `true`

    Specified by:
      `endPosition` in interface `MatchesIterator`

  - ### startOffset

    public int startOffset() throws IOException
    Description copied from interface: `MatchesIterator`
    The starting offset of the current match, or `-1` if offsets are not available

    Should only be called after `MatchesIterator.next()` has returned `true`

    Specified by:
      `startOffset` in interface `MatchesIterator`
    Throws:
      `IOException`

  - ### endOffset

    public int endOffset() throws IOException
    Description copied from interface: `MatchesIterator`
    The ending offset of the current match, or `-1` if offsets are not available

    Should only be called after `MatchesIterator.next()` has returned `true`

    Specified by:
      `endOffset` in interface `MatchesIterator`
    Throws:
      `IOException`

  - ### getSubMatches

    public MatchesIterator getSubMatches() throws IOException
    Description copied from interface: `MatchesIterator`
    Returns a MatchesIterator that iterates over the positions and offsets of individual terms within the current match

    Returns `null` if there are no submatches (ie the current iterator is at the leaf level)

    Should only be called after `MatchesIterator.next()` has returned `true`

    Specified by:
      `getSubMatches` in interface `MatchesIterator`
    Throws:
      `IOException`

  - ### getQuery

    public Query getQuery()
    Description copied from interface: `MatchesIterator`
    Returns the Query causing the current match

    If this `MatchesIterator` has been returned from a `MatchesIterator.getSubMatches()` call, then returns a `TermQuery` equivalent to the current match

    Should only be called after `MatchesIterator.next()` has returned `true`

    Specified by:
      `getQuery` in interface `MatchesIterator`