Class CompressingStoredFieldsFormat
- java.lang.Object
 - 
- org.apache.lucene.codecs.StoredFieldsFormat
 - 
- org.apache.lucene.codecs.compressing.CompressingStoredFieldsFormat
 
 
 
- 
- Direct Known Subclasses:
 Lucene41StoredFieldsFormat
public class CompressingStoredFieldsFormat extends StoredFieldsFormat
AStoredFieldsFormatthat is very similar toLucene40StoredFieldsFormatbut 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. In case this is a problem, you should use another format, such asLucene40StoredFieldsFormat.For optimal performance, you should use a
MergePolicythat returns segments that have the biggest byte size first. 
- 
- 
Constructor Summary
Constructors Constructor Description CompressingStoredFieldsFormat(java.lang.String formatName, java.lang.String segmentSuffix, CompressionMode compressionMode, int chunkSize)Create a newCompressingStoredFieldsFormat.CompressingStoredFieldsFormat(java.lang.String formatName, CompressionMode compressionMode, int chunkSize)Create a newCompressingStoredFieldsFormatwith 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)Returns aStoredFieldsReaderto load stored fields.StoredFieldsWriterfieldsWriter(Directory directory, SegmentInfo si, IOContext context)Returns aStoredFieldsWriterto write stored fields.java.lang.StringtoString() 
 - 
 
- 
- 
Constructor Detail
- 
CompressingStoredFieldsFormat
public CompressingStoredFieldsFormat(java.lang.String formatName, CompressionMode compressionMode, int chunkSize)Create a newCompressingStoredFieldsFormatwith an empty segment suffix. 
- 
CompressingStoredFieldsFormat
public CompressingStoredFieldsFormat(java.lang.String formatName, java.lang.String segmentSuffix, CompressionMode compressionMode, int chunkSize)Create a newCompressingStoredFieldsFormat.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 twoCompressingStoredFieldsFormats 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. In that case, both performance and compression ratio should be better than withLucene40StoredFieldsFormatwith compressed fields.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 documents- See Also:
 CompressionMode
 
 - 
 
- 
Method Detail
- 
fieldsReader
public StoredFieldsReader fieldsReader(Directory directory, SegmentInfo si, FieldInfos fn, IOContext context) throws java.io.IOException
Description copied from class:StoredFieldsFormatReturns aStoredFieldsReaderto load stored fields.- Specified by:
 fieldsReaderin classStoredFieldsFormat- Throws:
 java.io.IOException
 
- 
fieldsWriter
public StoredFieldsWriter fieldsWriter(Directory directory, SegmentInfo si, IOContext context) throws java.io.IOException
Description copied from class:StoredFieldsFormatReturns aStoredFieldsWriterto write stored fields.- Specified by:
 fieldsWriterin classStoredFieldsFormat- Throws:
 java.io.IOException
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
 - 
 
 -