public final class CompressingStoredFieldsIndexWriter
extends java.lang.Object
implements java.io.Closeable
Codec
s.
This writer generates a file which can be loaded into memory using memory-efficient data structures to quickly locate the block that contains any document.
In order to have a compact in-memory representation, for every block of 1024 chunks, this index computes the average number of bytes per chunk and for every chunk, only stores the difference between
Data is written as follows:
PackedInts.VERSION_CURRENT
as a VInt
VInt
, this marks the end of blocks since blocks are not allowed to start with 0VInt
which is the number of chunks encoded in the blockVInt
VInt
packed
array of BlockChunks elements of BitsPerDocBaseDelta bits each, representing the deltas from the average doc base using ZigZag encoding.VLong
VLong
packed
array of BlockChunks elements of BitsPerStartPointerDelta bits each, representing the deltas from the average start pointer using ZigZag encodingCodecFooter
Notes
DocBase + AvgChunkDocs * n + DocBaseDeltas[n]
.StartPointerBase + AvgChunkSize * n + StartPointerDeltas[n]
.Modifier and Type | Field and Description |
---|---|
(package private) int |
blockChunks |
(package private) int |
blockDocs |
(package private) int |
blockSize |
(package private) int[] |
docBaseDeltas |
(package private) IndexOutput |
fieldsIndexOut |
(package private) long |
firstStartPointer |
(package private) long |
maxStartPointer |
(package private) long[] |
startPointerDeltas |
(package private) int |
totalDocs |
Constructor and Description |
---|
CompressingStoredFieldsIndexWriter(IndexOutput indexOutput,
int blockSize) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
(package private) void |
finish(int numDocs,
long maxPointer) |
private void |
reset() |
private void |
writeBlock() |
(package private) void |
writeIndex(int numDocs,
long startPointer) |
final IndexOutput fieldsIndexOut
final int blockSize
int totalDocs
int blockDocs
int blockChunks
long firstStartPointer
long maxStartPointer
final int[] docBaseDeltas
final long[] startPointerDeltas
CompressingStoredFieldsIndexWriter(IndexOutput indexOutput, int blockSize) throws java.io.IOException
java.io.IOException
private void reset()
private void writeBlock() throws java.io.IOException
java.io.IOException
void writeIndex(int numDocs, long startPointer) throws java.io.IOException
java.io.IOException
void finish(int numDocs, long maxPointer) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException