Class PayloadIterator

  • Direct Known Subclasses:
    EnhancementsPayloadIterator

    public class PayloadIterator
    extends Object
    A utility class for iterating through a posting list of a given term and retrieving the payload of the first occurrence in every document. Comes with its own working space (buffer).
    WARNING: This API is experimental and might change in incompatible ways in the next release.
    • Field Detail

      • buffer

        protected byte[] buffer
      • payloadLength

        protected int payloadLength
    • Method Detail

      • init

        public boolean init()
                     throws IOException
        (re)initialize the iterator. Should be done before the first call to setdoc(int). Returns false if there is no category list found (no setdoc() will never return true).
        Throws:
        IOException
      • setdoc

        public boolean setdoc​(int docId)
                       throws IOException
        Skip forward to document docId. Return true if this document exists and has any payload.

        Users should call this method with increasing docIds, and implementations can assume that this is the case.

        Throws:
        IOException
      • getBuffer

        public byte[] getBuffer()
        Get the buffer with the content of the last read payload.
      • getPayloadLength

        public int getPayloadLength()
        Get the length of the last read payload.