CompressionMode (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.codecs.compressing, class: CompressionMode

Package org.apache.lucene.codecs.compressing

# Class CompressionMode

java.lang.Object
org.apache.lucene.codecs.compressing.CompressionMode

Direct Known Subclasses:
  `DeflateWithPresetDictCompressionMode`, `LZ4WithPresetDictCompressionMode`

public abstract class CompressionMode extends Object
A compression mode. Tells how much effort should be spent on compression and decompression of stored fields.

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final CompressionMode`
  `FAST`
  A compression mode that trades compression ratio for speed.
  `static final CompressionMode`
  `FAST_DECOMPRESSION`
  This compression mode is similar to `FAST` but it spends more time compressing in order to improve the compression ratio.
  `static final CompressionMode`
  `HIGH_COMPRESSION`
  A compression mode that trades speed for compression ratio.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `CompressionMode()`
  Sole constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract Compressor`
  `newCompressor()`
  Create a new `Compressor` instance.
  `abstract Decompressor`
  `newDecompressor()`
  Create a new `Decompressor` instance.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### FAST

    public static final CompressionMode FAST
    A compression mode that trades compression ratio for speed. Although the compression ratio might remain high, compression and decompression are very fast. Use this mode with indices that have a high update rate but should be able to load documents from disk quickly.

  - ### HIGH_COMPRESSION

    public static final CompressionMode HIGH_COMPRESSION
    A compression mode that trades speed for compression ratio. Although compression and decompression might be slow, this compression mode should provide a good compression ratio. This mode might be interesting if/when your index size is much bigger than your OS cache.

  - ### FAST_DECOMPRESSION

    public static final CompressionMode FAST_DECOMPRESSION
    This compression mode is similar to `FAST` but it spends more time compressing in order to improve the compression ratio. This compression mode is best used with indices that have a low update rate but should be able to load documents from disk quickly.

- ## Constructor Details

  - ### CompressionMode

    protected CompressionMode()
    Sole constructor.

- ## Method Details

  - ### newCompressor

    public abstract Compressor newCompressor()
    Create a new `Compressor` instance.

  - ### newDecompressor

    public abstract Decompressor newDecompressor()
    Create a new `Decompressor` instance.