Class Lucene50CompressingStoredFieldsFormat
- java.lang.Object
-
- org.apache.lucene.codecs.StoredFieldsFormat
-
- org.apache.lucene.backward_codecs.lucene50.compressing.Lucene50CompressingStoredFieldsFormat
-
public class Lucene50CompressingStoredFieldsFormat extends StoredFieldsFormat
AStoredFieldsFormatthat compresses documents in chunks in order to improve the compression ratio.For a chunk size of chunkSize bytes, this
StoredFieldsFormatdoes not support documents larger than (231 - chunkSize) bytes.For optimal performance, you should use a
MergePolicythat returns segments that have the biggest byte size first.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description protected intblockShiftblock shiftprotected intchunkSizechunk sizeprotected CompressionModecompressionModecompression modeprotected StringformatNameformat nameprotected intmaxDocsPerChunkmax docs per chunkprotected StringsegmentSuffixsegment suffix
-
Constructor Summary
Constructors Constructor Description Lucene50CompressingStoredFieldsFormat(String formatName, String segmentSuffix, CompressionMode compressionMode, int chunkSize, int maxDocsPerChunk, int blockShift)Create a newLucene50CompressingStoredFieldsFormat.Lucene50CompressingStoredFieldsFormat(String formatName, CompressionMode compressionMode, int chunkSize, int maxDocsPerChunk, int blockShift)Create a newLucene50CompressingStoredFieldsFormatwith an empty segment suffix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StoredFieldsReaderfieldsReader(Directory directory, SegmentInfo si, FieldInfos fn, IOContext context)StoredFieldsWriterfieldsWriter(Directory directory, SegmentInfo si, IOContext context)StringtoString()
-
-
-
Field Detail
-
formatName
protected final String formatName
format name
-
segmentSuffix
protected final String segmentSuffix
segment suffix
-
compressionMode
protected final CompressionMode compressionMode
compression mode
-
chunkSize
protected final int chunkSize
chunk size
-
maxDocsPerChunk
protected final int maxDocsPerChunk
max docs per chunk
-
blockShift
protected final int blockShift
block shift
-
-
Constructor Detail
-
Lucene50CompressingStoredFieldsFormat
public Lucene50CompressingStoredFieldsFormat(String formatName, CompressionMode compressionMode, int chunkSize, int maxDocsPerChunk, int blockShift)
Create a newLucene50CompressingStoredFieldsFormatwith an empty segment suffix.
-
Lucene50CompressingStoredFieldsFormat
public Lucene50CompressingStoredFieldsFormat(String formatName, String segmentSuffix, CompressionMode compressionMode, int chunkSize, int maxDocsPerChunk, int blockShift)
Create a newLucene50CompressingStoredFieldsFormat.formatNameis the name of the format. This name will be used in the file formats to performcodec header checks.segmentSuffixis the segment suffix. This suffix is added to the result file name only if it's not the empty string.The
compressionModeparameter allows you to choose between compression algorithms that have various compression and decompression speeds so that you can pick the one that best fits your indexing and searching throughput. You should never instantiate twoLucene50CompressingStoredFieldsFormats that have the same name but differentCompressionModes.chunkSizeis the minimum byte size of a chunk of documents. A value of1can make sense if there is redundancy across fields.maxDocsPerChunkis an upperbound on how many docs may be stored in a single chunk. This is to bound the cpu costs for highly compressible data.Higher values of
chunkSizeshould improve the compression ratio but will require more memory at indexing time and might make document loading a little slower (depending on the size of your OS cache compared to the size of your index).- Parameters:
formatName- the name of theStoredFieldsFormatcompressionMode- theCompressionModeto usechunkSize- the minimum number of bytes of a single chunk of stored documentsmaxDocsPerChunk- the maximum number of documents in a single chunkblockShift- the log in base 2 of number of chunks to store in an index block- See Also:
CompressionMode
-
-
Method Detail
-
fieldsReader
public StoredFieldsReader fieldsReader(Directory directory, SegmentInfo si, FieldInfos fn, IOContext context) throws IOException
- Specified by:
fieldsReaderin classStoredFieldsFormat- Throws:
IOException
-
fieldsWriter
public StoredFieldsWriter fieldsWriter(Directory directory, SegmentInfo si, IOContext context) throws IOException
- Specified by:
fieldsWriterin classStoredFieldsFormat- Throws:
IOException
-
-