Class CompressingStoredFieldsFormat
- Direct Known Subclasses:
Lucene41StoredFieldsFormat
StoredFieldsFormat
that is very similar to
Lucene40StoredFieldsFormat
but compresses documents in chunks in
order to improve the compression ratio.
For a chunk size of chunkSize bytes, this StoredFieldsFormat
does not support documents larger than (231 - chunkSize)
bytes. In case this is a problem, you should use another format, such as
Lucene40StoredFieldsFormat
.
For optimal performance, you should use a MergePolicy
that returns
segments that have the biggest byte size first.
-
Constructor Summary
ConstructorsConstructorDescriptionCompressingStoredFieldsFormat
(String formatName, String segmentSuffix, CompressionMode compressionMode, int chunkSize) Create a newCompressingStoredFieldsFormat
.CompressingStoredFieldsFormat
(String formatName, CompressionMode compressionMode, int chunkSize) Create a newCompressingStoredFieldsFormat
with an empty segment suffix. -
Method Summary
Modifier and TypeMethodDescriptionfieldsReader
(Directory directory, SegmentInfo si, FieldInfos fn, IOContext context) Returns aStoredFieldsReader
to load stored fields.fieldsWriter
(Directory directory, SegmentInfo si, IOContext context) Returns aStoredFieldsWriter
to write stored fields.toString()
-
Constructor Details
-
CompressingStoredFieldsFormat
public CompressingStoredFieldsFormat(String formatName, CompressionMode compressionMode, int chunkSize) Create a newCompressingStoredFieldsFormat
with an empty segment suffix. -
CompressingStoredFieldsFormat
public CompressingStoredFieldsFormat(String formatName, String segmentSuffix, CompressionMode compressionMode, int chunkSize) Create a newCompressingStoredFieldsFormat
.formatName
is the name of the format. This name will be used in the file formats to performcodec header checks
.segmentSuffix
is the segment suffix. This suffix is added to the result file name only if it's not the empty string.The
compressionMode
parameter 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 twoCompressingStoredFieldsFormat
s that have the same name but differentCompressionMode
s.chunkSize
is the minimum byte size of a chunk of documents. A value of1
can make sense if there is redundancy across fields. In that case, both performance and compression ratio should be better than withLucene40StoredFieldsFormat
with compressed fields.Higher values of
chunkSize
should 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 theStoredFieldsFormat
compressionMode
- theCompressionMode
to usechunkSize
- the minimum number of bytes of a single chunk of stored documents- See Also:
-
-
Method Details
-
fieldsReader
public StoredFieldsReader fieldsReader(Directory directory, SegmentInfo si, FieldInfos fn, IOContext context) throws IOException Description copied from class:StoredFieldsFormat
Returns aStoredFieldsReader
to load stored fields.- Specified by:
fieldsReader
in classStoredFieldsFormat
- Throws:
IOException
-
fieldsWriter
public StoredFieldsWriter fieldsWriter(Directory directory, SegmentInfo si, IOContext context) throws IOException Description copied from class:StoredFieldsFormat
Returns aStoredFieldsWriter
to write stored fields.- Specified by:
fieldsWriter
in classStoredFieldsFormat
- Throws:
IOException
-
toString
-