org.apache.lucene.index

## Class RandomAccessOrds

- java.lang.Object
- - org.apache.lucene.index.SortedSetDocValues
  - - org.apache.lucene.index.RandomAccessOrds

-     public abstract class RandomAccessOrds
      extends SortedSetDocValues

  Extension of `SortedSetDocValues` that supports random access to the ordinals of a document.

  Operations via this API are independent of the iterator api (`SortedSetDocValues.nextOrd()`) and do not impact its state.

  Codecs can optionally extend this API if they support constant-time access to ordinals for the document.

- - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.index.SortedSetDocValues

      `NO_MORE_ORDS`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `RandomAccessOrds()` Sole constructor.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract int` | `cardinality()` Returns the cardinality for the current document (previously set by `SortedSetDocValues.setDocument(int)`.
    `abstract long` | `ordAt(int index)` Retrieve the ordinal for the current document (previously set by `SortedSetDocValues.setDocument(int)` at the specified index.

    - ### Methods inherited from class org.apache.lucene.index.SortedSetDocValues

      `getValueCount, intersect, lookupOrd, lookupTerm, nextOrd, setDocument, termsEnum`

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

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

- - ### Constructor Detail

    - #### RandomAccessOrds

          protected RandomAccessOrds()

      Sole constructor. (For invocation by subclass constructors, typically implicit.)

  - ### Method Detail

    - #### ordAt

          public abstract long ordAt(int index)

      Retrieve the ordinal for the current document (previously set by `SortedSetDocValues.setDocument(int)` at the specified index.

      An index ranges from `0` to `cardinality()-1`. The first ordinal value is at index `0`, the next at index `1`, and so on, as for array indexing.

      Parameters:
        `index` - index of the ordinal for the document.
      Returns:
        ordinal for the document at the specified index.

    - #### cardinality

          public abstract int cardinality()

      Returns the cardinality for the current document (previously set by `SortedSetDocValues.setDocument(int)`.

Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.