Module org.elasticsearch.server
Class DocIdsWriter
java.lang.Object
org.elasticsearch.index.codec.vectors.diskbbq.DocIdsWriter
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 -
Method Summary
Modifier and TypeMethodDescriptionbytecalculateBlockEncoding(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.voidreadInts(org.apache.lucene.store.IndexInput in, int count, byte encoding, int[] docIDs) voidreadInts(org.apache.lucene.store.IndexInput in, int count, int[] docIDs) Readcountintegers intodocIDs.voidwriteDocIds(org.apache.lucene.util.hnsw.IntToIntFunction docIds, int count, byte encoding, org.apache.lucene.store.DataOutput out) voidwriteDocIds(org.apache.lucene.util.hnsw.IntToIntFunction docIds, int count, org.apache.lucene.store.DataOutput out)
-
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 idscount- number of doc idsblockSize- 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 Readcountintegers intodocIDs.- Throws:
IOException
-