Class DirectInvertedOutputStream

    • Field Detail

      • output

        protected BitOut output
        what to write to
      • lastDocid

        protected int lastDocid
      • logger

        protected static final org.slf4j.Logger logger
        The logger used
    • Constructor Detail

      • DirectInvertedOutputStream

        public DirectInvertedOutputStream​(java.io.OutputStream os)
                                   throws java.io.IOException
        Creates a new output stream, writing a BitOutputStream to the specified file. The number of binary bits for fields must also be specified.
        Parameters:
        os - stream to write to
        Throws:
        java.io.IOException
      • DirectInvertedOutputStream

        public DirectInvertedOutputStream​(java.lang.String filename)
                                   throws java.io.IOException
        Creates a new output stream, writing a BitOutputStream to the specified file. The number of binary bits for fields must also be specified.
        Parameters:
        filename - Location of the file to write to
        Throws:
        java.io.IOException
      • DirectInvertedOutputStream

        public DirectInvertedOutputStream​(BitOut out)
        Creates a new output stream, writing to the specified BitOut implementation. The number of binary bits for fields must also be specified.
        Parameters:
        out - BitOut implementation to write the file to
    • Method Detail

      • writePostings

        public BitIndexPointer writePostings​(int[][] postings,
                                             int firstId)
                                      throws java.io.IOException
        Write out the specified postings. The delta for the first id must be specified.
        Parameters:
        postings - The postings to write out
        firstId - the (delta) value of the first docid to write out.
        Throws:
        java.io.IOException
      • writePostings

        public BitIndexPointer writePostings​(java.util.Iterator<Posting> iterator,
                                             int previousId)
                                      throws java.io.IOException
        Write out the specified postings, but allowing the delta for the first document to be adjusted
        Specified by:
        writePostings in class AbstractPostingOutputStream
        Parameters:
        iterator - an Iterator of Posting objects
        previousId - id of the previous posting in this stream
        Throws:
        java.io.IOException
      • writePostings

        public BitIndexPointer writePostings​(IterablePosting postings,
                                             int previousId)
                                      throws java.io.IOException
        Write out the specified postings, but allowing the delta for the first document to be adjusted
        Specified by:
        writePostings in class AbstractPostingOutputStream
        Parameters:
        postings - IterablePosting postings accessed through an IterablePosting object
        previousId - id of the previous posting in this stream
        Throws:
        java.io.IOException
      • writePostingNotDocid

        protected void writePostingNotDocid​(Posting p)
                                     throws java.io.IOException
        Hook method for writing out the remainder of the posting
        Throws:
        java.io.IOException
      • writePostings

        public BitIndexPointer writePostings​(int[][] postings,
                                             int startOffset,
                                             int Length,
                                             int firstId)
                                      throws java.io.IOException
        Write out a range of the specified postings. The delta for the first id must be specified.
        Specified by:
        writePostings in class AbstractPostingOutputStream
        Parameters:
        postings - The postings to write out
        startOffset - The location of the first posting to write out.
        Length - The number of postings to be written out.
        firstId - the (delta) value of the first docid to write out.
        Throws:
        java.io.IOException
      • writeNoFieldPostings

        protected BitIndexPointer writeNoFieldPostings​(int[][] postings,
                                                       int offset,
                                                       int length,
                                                       int firstId)
                                                throws java.io.IOException
        Writes the given postings to the bit file. This method assumes that field information is not provided.
        Parameters:
        postings - the postings list to write.
        firstId - the first identifier to write. This can be an id plus one, or the gap of the current id and the previous one.
        offset - The location of the first posting to write out.
        length - The number of postings to be written out.
        Throws:
        java.io.IOException - if an error occurs during writing to a file.
      • close

        public void close()
        close this object. suppresses any exception
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class AbstractPostingOutputStream
      • getByteOffset

        public long getByteOffset()
        Deprecated.
        Return the current offset in bytes in the written file
      • getBitOffset

        public byte getBitOffset()
        Deprecated.
        Return the current offset in bits in the written file
      • getBitOut

        public BitOut getBitOut()
        Return the underlying BitOut implementation being used by the class