count

open fun count(context: LeafReaderContext): Int

Counts the number of live documents that match a given this.query in a leaf.

The default implementation returns -1 for every query. This indicates that the count could not be computed in sub-linear time.

Specific query classes should override it to provide other accurate sub-linear implementations (that actually return the count). Look at for an example

We use this property of the function to count hits in IndexSearcher.count.

Return

integer count of the number of matches

Parameters

context

the org.gnit.lucenekmp.index.LeafReaderContext for which to return the count.

Throws

IOException

if there is a low-level I/O error