java.lang.Object
org.elasticsearch.index.codec.vectors.diskbbq.DocIdsWriter

public final class DocIdsWriter extends Object
This class is used to write and read the doc ids in a compressed format. The format is optimized for the number of bits per value (bpv) and the number of values.

It is copied from the BKD implementation.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    byte
    calculateBlockEncoding(org.apache.lucene.util.hnsw.IntToIntFunction docIds, int count, int blockSize)
    Calculate the best encoding that will be used to write blocks of doc ids of blockSize.
    void
    readInts(org.apache.lucene.store.IndexInput in, int count, byte encoding, int[] docIDs)
     
    void
    readInts(org.apache.lucene.store.IndexInput in, int count, int[] docIDs)
    Read count integers into docIDs.
    void
    writeDocIds(org.apache.lucene.util.hnsw.IntToIntFunction docIds, int count, byte encoding, org.apache.lucene.store.DataOutput out)
     
    void
    writeDocIds(org.apache.lucene.util.hnsw.IntToIntFunction docIds, int count, org.apache.lucene.store.DataOutput out)
     

    Methods inherited from class java.lang.Object

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

    • DocIdsWriter

      public DocIdsWriter()
  • Method Details

    • calculateBlockEncoding

      public byte calculateBlockEncoding(org.apache.lucene.util.hnsw.IntToIntFunction docIds, int count, int blockSize)
      Calculate the best encoding that will be used to write blocks of doc ids of blockSize. The encoding choice is universal for all the blocks, which means that the encoding is only as efficient as the worst block.
      Parameters:
      docIds - function to access the doc ids
      count - number of doc ids
      blockSize - the block size
      Returns:
      the byte encoding to use for the blocks
    • writeDocIds

      public void writeDocIds(org.apache.lucene.util.hnsw.IntToIntFunction docIds, int count, byte encoding, org.apache.lucene.store.DataOutput out) throws IOException
      Throws:
      IOException
    • writeDocIds

      public void writeDocIds(org.apache.lucene.util.hnsw.IntToIntFunction docIds, int count, org.apache.lucene.store.DataOutput out) throws IOException
      Throws:
      IOException
    • readInts

      public void readInts(org.apache.lucene.store.IndexInput in, int count, byte encoding, int[] docIDs) throws IOException
      Throws:
      IOException
    • readInts

      public void readInts(org.apache.lucene.store.IndexInput in, int count, int[] docIDs) throws IOException
      Read count integers into docIDs.
      Throws:
      IOException