OrdinalsCursor (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.document.column, class: OrdinalsCursor

Package org.apache.lucene.document.column

# Class OrdinalsCursor

java.lang.Object
org.apache.lucene.document.column.OrdinalsCursor

public abstract class OrdinalsCursor extends Object
A dense values cursor over a `DictionaryColumn`. Produces exactly `size()` ordinals for consecutive batch-local doc-ids starting at 0, one per call to `nextOrd()`.

Each ordinal must be in `[0, column.dictionary().length)`.

Implementations must throw an exception if `nextOrd()` is called more than `size()` times.

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `OrdinalsCursor(int size)`
  Creates a cursor that will produce exactly `size` ordinals, one per batch-local doc-id in `[0, size)`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract int`
  `nextOrd()`
  Returns the next ordinal.
  `final int`
  `size()`
  Total number of ordinals this cursor will produce.

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

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

- ## Constructor Details

  - ### OrdinalsCursor

    protected OrdinalsCursor(int size)
    Creates a cursor that will produce exactly `size` ordinals, one per batch-local doc-id in `[0, size)`.

- ## Method Details

  - ### size

    public final int size()
    Total number of ordinals this cursor will produce.

  - ### nextOrd

    public abstract int nextOrd()
    Returns the next ordinal. Must not be called more than `size()` times.

    The returned value must be in `[0, dictionary.length)` where `dictionary` is the enclosing column's dictionary. The indexing path validates this on every call and throws `IllegalArgumentException` on violation.