Class Lucene40LiveDocsFormat
- java.lang.Object
-
- org.apache.lucene.codecs.LiveDocsFormat
-
- org.apache.lucene.codecs.lucene40.Lucene40LiveDocsFormat
-
public class Lucene40LiveDocsFormat extends LiveDocsFormat
Lucene 4.0 Live Documents Format.The .del file is optional, and only exists when a segment contains deletions.
Although per-segment, this file is maintained exterior to compound segment files.
Deletions (.del) --> Format,Header,ByteCount,BitCount, Bits | DGaps (depending on Format)
- Format,ByteSize,BitCount -->
Uint32
- Bits --> <
Byte
> ByteCount - DGaps --> <DGap,NonOnesByte> NonzeroBytesCount
- DGap -->
VInt
- NonOnesByte -->
Byte
- Header -->
CodecHeader
Format is 1: indicates cleared DGaps.
ByteCount indicates the number of bytes in Bits. It is typically (SegSize/8)+1.
BitCount indicates the number of bits that are currently set in Bits.
Bits contains one bit for each document indexed. When the bit corresponding to a document number is cleared, that document is marked as deleted. Bit ordering is from least to most significant. Thus, if Bits contains two bytes, 0x00 and 0x02, then document 9 is marked as alive (not deleted).
DGaps represents sparse bit-vectors more efficiently than Bits. It is made of DGaps on indexes of nonOnes bytes in Bits, and the nonOnes bytes themselves. The number of nonOnes bytes in Bits (NonOnesBytesCount) is not stored.
For example, if there are 8000 bits and only bits 10,12,32 are cleared, DGaps would be used:
(VInt) 1 , (byte) 20 , (VInt) 3 , (Byte) 1
- Format,ByteSize,BitCount -->
-
-
Constructor Summary
Constructors Constructor Description Lucene40LiveDocsFormat()
Sole constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
files(SegmentCommitInfo info, java.util.Collection<java.lang.String> files)
Records all files in use by thisSegmentCommitInfo
into the files argument.MutableBits
newLiveDocs(int size)
Creates a new MutableBits, with all bits set, for the specified size.MutableBits
newLiveDocs(Bits existing)
Creates a new mutablebits of the same bits set and size of existing.Bits
readLiveDocs(Directory dir, SegmentCommitInfo info, IOContext context)
Read live docs bits.void
writeLiveDocs(MutableBits bits, Directory dir, SegmentCommitInfo info, int newDelCount, IOContext context)
Persist live docs bits.
-
-
-
Method Detail
-
newLiveDocs
public MutableBits newLiveDocs(int size) throws java.io.IOException
Description copied from class:LiveDocsFormat
Creates a new MutableBits, with all bits set, for the specified size.- Specified by:
newLiveDocs
in classLiveDocsFormat
- Throws:
java.io.IOException
-
newLiveDocs
public MutableBits newLiveDocs(Bits existing) throws java.io.IOException
Description copied from class:LiveDocsFormat
Creates a new mutablebits of the same bits set and size of existing.- Specified by:
newLiveDocs
in classLiveDocsFormat
- Throws:
java.io.IOException
-
readLiveDocs
public Bits readLiveDocs(Directory dir, SegmentCommitInfo info, IOContext context) throws java.io.IOException
Description copied from class:LiveDocsFormat
Read live docs bits.- Specified by:
readLiveDocs
in classLiveDocsFormat
- Throws:
java.io.IOException
-
writeLiveDocs
public void writeLiveDocs(MutableBits bits, Directory dir, SegmentCommitInfo info, int newDelCount, IOContext context) throws java.io.IOException
Description copied from class:LiveDocsFormat
Persist live docs bits. UseSegmentCommitInfo.getNextDelGen()
to determine the generation of the deletes file you should write to.- Specified by:
writeLiveDocs
in classLiveDocsFormat
- Throws:
java.io.IOException
-
files
public void files(SegmentCommitInfo info, java.util.Collection<java.lang.String> files) throws java.io.IOException
Description copied from class:LiveDocsFormat
Records all files in use by thisSegmentCommitInfo
into the files argument.- Specified by:
files
in classLiveDocsFormat
- Throws:
java.io.IOException
-
-