Class PostingUtil


  • public class PostingUtil
    extends java.lang.Object
    Handy methods for Posting classes, such as obtaining all ids in a posting list, or selecting the minimum id in an array of posting lists.
    Since:
    3.0
    Author:
    Craig Macdonald
    • Constructor Summary

      Constructors 
      Constructor Description
      PostingUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int[][] getAllPostings​(IterablePosting ip)
      Get an array of all the ids in a given IterablePosting stream, where the length of the stream is known
      static int[][] getAllPostings​(IterablePosting ip, int numPointers)
      Get an array of all the ids and frequencies in a given IterablePosting stream, where the length of the stream is unknown
      static int[][] getAllPostingsWithFields​(IterablePosting ip, int numPointers, int fieldCount)
      Get an array of all the ids in a given IterablePosting stream, where the length of the stream is known
      static int[] getIds​(IterablePosting ip)
      Get an array of all the ids in a given IterablePosting stream
      static int[] getIds​(IterablePosting ip, int numPointers)
      Get an array of all the ids in a given IterablePosting stream, where the length of the stream is known
      static int selectMinimumDocId​(IterablePosting[] postingListArray)
      Returns the minimum docid of the current postings in the array of IterablePostings
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PostingUtil

        public PostingUtil()
    • Method Detail

      • getIds

        public static int[] getIds​(IterablePosting ip)
                            throws java.io.IOException
        Get an array of all the ids in a given IterablePosting stream
        Throws:
        java.io.IOException
      • getIds

        public static int[] getIds​(IterablePosting ip,
                                   int numPointers)
                            throws java.io.IOException
        Get an array of all the ids in a given IterablePosting stream, where the length of the stream is known
        Throws:
        java.io.IOException
      • getAllPostings

        public static int[][] getAllPostings​(IterablePosting ip,
                                             int numPointers)
                                      throws java.io.IOException
        Get an array of all the ids and frequencies in a given IterablePosting stream, where the length of the stream is unknown
        Throws:
        java.io.IOException
      • getAllPostingsWithFields

        public static int[][] getAllPostingsWithFields​(IterablePosting ip,
                                                       int numPointers,
                                                       int fieldCount)
                                                throws java.io.IOException
        Get an array of all the ids in a given IterablePosting stream, where the length of the stream is known
        Throws:
        java.io.IOException
      • getAllPostings

        public static int[][] getAllPostings​(IterablePosting ip)
                                      throws java.io.IOException
        Get an array of all the ids in a given IterablePosting stream, where the length of the stream is known
        Throws:
        java.io.IOException
      • selectMinimumDocId

        public static int selectMinimumDocId​(IterablePosting[] postingListArray)
        Returns the minimum docid of the current postings in the array of IterablePostings
        Returns:
        minimum docid, or -1 if all postings have ended.