Skip to content

Commit

Permalink
Use lowercase letters for zstd, zstdnodict compression codecs. (#7231)
Browse files Browse the repository at this point in the history
Signed-off-by: Mulugeta Mammo <[email protected]>
(cherry picked from commit e791d46)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Apr 20, 2023
1 parent 834d998 commit 25df20a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
/**
* A plugin that implements custom codecs. Supports these codecs:
* <ul>
* <li>ZSTD
* <li>ZSTDNODICT
* <li>zstd
* <li>zstdnodict
* </ul>
*
* @opensearch.internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import org.apache.lucene.codecs.FilterCodec;
import org.apache.lucene.codecs.lucene95.Lucene95Codec;

import java.util.Locale;

abstract class Lucene95CustomCodec extends FilterCodec {
public static final int DEFAULT_COMPRESSION_LEVEL = 6;

Expand All @@ -23,13 +25,25 @@ public enum Mode {

private final StoredFieldsFormat storedFieldsFormat;

/** new codec for a given compression algorithm and default compression level */
/**
* Creates a new compression codec with the default compression level.
*
* @param mode The compression codec (ZSTD or ZSTDNODICT).
*/
public Lucene95CustomCodec(Mode mode) {
this(mode, DEFAULT_COMPRESSION_LEVEL);
}

/**
* Creates a new compression codec with the given compression level. We use
* lowercase letters when registering the codec so that we remain consistent with
* the other compression codecs: default, lucene_default, and best_compression.
*
* @param mode The compression codec (ZSTD or ZSTDNODICT).
* @parama compressionLevel The compression level.
*/
public Lucene95CustomCodec(Mode mode, int compressionLevel) {
super(mode.name(), new Lucene95Codec());
super(mode.name().toLowerCase(Locale.ROOT), new Lucene95Codec());
this.storedFieldsFormat = new Lucene95CustomStoredFieldsFormat(mode, compressionLevel);
}

Expand Down

0 comments on commit 25df20a

Please sign in to comment.