MatchesIterator

interface MatchesIterator

An iterator over match positions (and optionally offsets) for a single document and field

To iterate over the matches, call .next until it returns false, retrieving positions and/or offsets after each call. You should not call the position or offset methods before .next has been called, or after .next has returned false.

Matches from some queries may span multiple positions. You can retrieve the positions of individual matching terms on the current match by calling .getSubMatches.

Matches are ordered by start position, and then by end position. Match intervals may overlap.

See also

Properties

Link copied to clipboard
abstract val query: Query

Returns the Query causing the current match

Link copied to clipboard

Functions

Link copied to clipboard
abstract fun endOffset(): Int

The ending offset of the current match, or -1 if offsets are not available

Link copied to clipboard
abstract fun endPosition(): Int

The end position of the current match, or -1 if positions are not available

Link copied to clipboard
abstract fun next(): Boolean

Advance the iterator to the next match position

Link copied to clipboard
abstract fun startOffset(): Int

The starting offset of the current match, or -1 if offsets are not available

Link copied to clipboard
abstract fun startPosition(): Int

The start position of the current match, or -1 if positions are not available