Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessors for custom compression modes #89

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public class Lucene95CustomStoredFieldsFormat extends StoredFieldsFormat {
/** A key that we use to map to a mode */
public static final String MODE_KEY = Lucene95CustomStoredFieldsFormat.class.getSimpleName() + ".mode";

private static final int ZSTD_BLOCK_LENGTH = 10 * 48 * 1024;
private static final int ZSTD_MAX_DOCS_PER_BLOCK = 4096;
private static final int ZSTD_BLOCK_SHIFT = 10;
protected static final int ZSTD_BLOCK_LENGTH = 10 * 48 * 1024;
protected static final int ZSTD_MAX_DOCS_PER_BLOCK = 4096;
protected static final int ZSTD_BLOCK_SHIFT = 10;

private final CompressionMode zstdCompressionMode;
private final CompressionMode zstdNoDictCompressionMode;
Expand Down Expand Up @@ -122,7 +122,7 @@ StoredFieldsFormat impl(Lucene95CustomCodec.Mode mode) {
}
}

Lucene95CustomCodec.Mode getMode() {
public Lucene95CustomCodec.Mode getMode() {
return mode;
}

Expand All @@ -132,4 +132,9 @@ Lucene95CustomCodec.Mode getMode() {
public int getCompressionLevel() {
return compressionLevel;
}

public CompressionMode getCompressionMode() {
sarthakaggarwal97 marked this conversation as resolved.
Show resolved Hide resolved
return mode == Lucene95CustomCodec.Mode.ZSTD_NO_DICT ? zstdNoDictCompressionMode : zstdCompressionMode;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,14 @@ public void testZstdNoDictLucene95CustomCodecModeWithCompressionLevel() {
assertEquals(randomCompressionLevel, lucene95CustomStoredFieldsFormat.getCompressionLevel());
}

public void testCompressionModes(){
Lucene95CustomStoredFieldsFormat lucene95CustomStoredFieldsFormat = new Lucene95CustomStoredFieldsFormat();
assertTrue(lucene95CustomStoredFieldsFormat.getCompressionMode() instanceof ZstdCompressionMode);
}

public void testZstdNoDictCompressionModes(){
Lucene95CustomStoredFieldsFormat lucene95CustomStoredFieldsFormat = new Lucene95CustomStoredFieldsFormat(Lucene95CustomCodec.Mode.ZSTD_NO_DICT);
assertTrue(lucene95CustomStoredFieldsFormat.getCompressionMode() instanceof ZstdNoDictCompressionMode);
}

}
Loading