KeyCursor

class KeyCursor

Candidate keys, in segment order and ascending within each segment.

A key may be reported more than once, by different segments — an updated document is in the newest segment that holds it and in every older one that has not yet compacted it away. That is not a defect to be smoothed over here: the recheck resolves each key against the visible version, so one key reported three times yields one answer, and deduplicating early would cost a set over millions of keys to save the caller a fact it already has to handle.

Valid only while the IndexReader that produced it is open, because the ordinals are read straight off that reader's mappings.

Properties

Link copied to clipboard
val key: Key

The key at the cursor.

Link copied to clipboard

The segment the current key was found in.

Functions

Link copied to clipboard
fun next(): Boolean

Advances to the next candidate, or returns false when there are none left.

Link copied to clipboard

Every candidate key, deduplicated and sorted. Convenient for a caller with a small result.