TwoPhaseIterator

abstract class TwoPhaseIterator

Returned by Scorer.twoPhaseIterator to expose an approximation of a [ ]. When the .approximation's DocIdSetIterator.nextDoc or DocIdSetIterator.advance return, .matches needs to be checked in order to know whether the returned doc ID actually matches.

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard

Return an approximation. The returned DocIdSetIterator is a superset of the matching documents, and each match needs to be confirmed with .matches in order to know whether it matches or not.

Link copied to clipboard
abstract fun matchCost(): Float

An estimate of the expected cost to determine that a single document .matches. This can be called before iterating the documents of .approximation. Returns an expected cost in number of simple operations like addition, multiplication, comparing two numbers and indexing an array. The returned value must be positive.

Link copied to clipboard
abstract fun matches(): Boolean

Return whether the current doc ID that .approximation is on matches. This method should only be called when the iterator is positioned -- ie. not when is -1 or DocIdSetIterator.NO_MORE_DOCS -- and at most once.