Class ORIterablePosting

    • Constructor Detail

      • ORIterablePosting

        public ORIterablePosting​(IterablePosting[] ips)
                          throws java.io.IOException
        Create a Basic ORIterablePosting from the specified postings
        Throws:
        java.io.IOException
    • Method Detail

      • mergePostings

        public static ORIterablePosting mergePostings​(IterablePosting[] ips)
                                               throws java.io.IOException
        Factory method to create an appropriate ORIterablePosting from the specified IterablePostings. Four types of ORIterablePosting maybe returned, based on the lowest common denominator type of the specified IterablePosting classes:
        • BlockFieldORIterablePosting - if the all posting lists are both a BlockPosting and FieldPosting
        • BlockORIterablePosting - if the all posting lists are a BlockPosting but not all a FieldPosting
        • FieldORIterablePosting - if the all posting lists are a FieldPosting but not all a BlockPosing
        • ORIterablePosting - otherwise
        Throws:
        java.io.IOException
      • firstPosting

        protected void firstPosting​(Posting p)
      • addPosting

        protected void addPosting​(Posting p)
      • next

        public int next()
                 throws java.io.IOException
        Move this iterator to the next posting.
        Returns:
        id of next posting, or EOL if end of posting list.
        Throws:
        java.io.IOException
      • next

        public int next​(int target)
                 throws java.io.IOException
        Description copied from class: IterablePostingImpl
        This implementation of next(int) which uses next()
        Specified by:
        next in interface IterablePosting
        Overrides:
        next in class IterablePostingImpl
        Parameters:
        target - id of the posting to find in this posting list.
        Returns:
        id of the posting found, or EOL if end of posting list is reached.
        Throws:
        java.io.IOException
      • asWritablePosting

        public WritablePosting asWritablePosting()
        Copy this posting to one free of an iterator. Kind of like a clone.
        Returns:
        an identical posting, but which can be manipulated free of this iterator
      • getDocumentLength

        public int getDocumentLength()
        Return the length of the document of the current posting in tokens. Usually uses the DocumentIndex, may do otherwise if document length statistics are in posting list.
        Returns:
        length of the document of the current posting in tokens.
      • getFrequency

        public int getFrequency()
        Return the frequency of the term in the current document, in tokens.
        Returns:
        frequency of the term in the current document, in tokens.
      • getId

        public int getId()
        Return the id of the current posting. For the inverted index, this is the current docid; for the direct index it corresponds to the current term id.
        Returns:
        id of the posting.
      • close

        public void close()
                   throws java.io.IOException
        Throws:
        java.io.IOException