Interface IndexIterator

    • Field Detail

      • END_OF_POSITIONS

        static final int END_OF_POSITIONS
        A special value denoting that the end of the position list has been reached.
        See Also:
        Constant Field Values
    • Method Detail

      • index

        Index index()
        Returns the index over which this iterator is built.
        Returns:
        the index over which this iterator is built.
      • term

        IndexIterator term​(CharSequence term)
        Sets the term whose inverted list is returned by this index iterator.

        Usually, the term is automatically set by Index.documents(CharSequence) or by IndexReader.documents(CharSequence), but you can use this method to ensure that term() doesn't throw an exception.

        Parameters:
        term - a character sequence (that will be defensively copied) that will be assumed to be the term whose inverted list is returned by this index iterator.
        Returns:
        this index iterator.
      • frequency

        long frequency()
                throws IOException
        Returns the frequency, that is, the number of documents that will be returned by this iterator.
        Returns:
        the number of documents that will be returned by this iterator.
        Throws:
        IOException
      • payload

        Payload payload()
                 throws IOException
        Returns the payload, if any, associated with the current document.
        Returns:
        the payload associated with the current document.
        Throws:
        IOException
      • count

        int count()
           throws IOException
        Returns the count, that is, the number of occurrences of the term in the current document.
        Returns:
        the count (number of occurrences) of the term in the current document.
        Throws:
        UnsupportedOperationException - if the index of this iterator does not contain counts.
        IOException
      • nextPosition

        int nextPosition()
                  throws IOException
        Returns the next position at which the term appears in the current document.
        Returns:
        the next position of the current document in which the current term appears, or END_OF_POSITIONS if there are no more positions.
        Throws:
        UnsupportedOperationException - if the index of this iterator does not contain positions.
        IOException
      • id

        IndexIterator id​(int id)
        Sets the id of this index iterator.

        The id is an integer associated with each index iterator. It has no specific semantics, and can be used differently in different contexts. A typical usage pattern, for instance, is using it to assign a unique number to the index iterators contained in a composite document iterator (say, numbering consecutively the leaves of the composite).

        Parameters:
        id - the new id for this index iterator.
        Returns:
        this index iterator.
      • id

        int id()
        Returns the id of this index iterator.
        Returns:
        the id of this index iterator.
        See Also:
        id(int)