Override toString (useful for debugging with -Dtests.verbose).

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1396600 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrien Grand 2012-10-10 13:42:56 +00:00
parent e5aea5dd96
commit e4b5a7d907
2 changed files with 18 additions and 7 deletions

View File

@ -40,7 +40,7 @@ import org.apache.lucene.store.IOContext;
*/ */
public class CompressingStoredFieldsFormat extends StoredFieldsFormat { public class CompressingStoredFieldsFormat extends StoredFieldsFormat {
private final CompressingStoredFieldsIndex storedFieldsIndexFormat; private final CompressingStoredFieldsIndex storedFieldsIndex;
private final CompressionMode compressionMode; private final CompressionMode compressionMode;
private final int chunkSize; private final int chunkSize;
@ -63,24 +63,24 @@ public class CompressingStoredFieldsFormat extends StoredFieldsFormat {
* loading a little slower (depending on the size of your OS cache compared * loading a little slower (depending on the size of your OS cache compared
* to the size of your index). * to the size of your index).
* <p> * <p>
* The <code>storedFieldsIndexFormat</code> parameter allows you to choose * The <code>storedFieldsIndex</code> parameter allows you to choose between
* bettwen several fields index formats that offer various trade-offs between * several fields index implementations that offer various trade-offs between
* memory usage and speed. * memory usage and speed.
* *
* @param compressionMode the {@link CompressionMode} to use * @param compressionMode the {@link CompressionMode} to use
* @param chunkSize the minimum number of bytes of a single chunk of stored documents * @param chunkSize the minimum number of bytes of a single chunk of stored documents
* @param storedFieldsIndexFormat the format to use to load the fields index * @param storedFieldsIndex the fields index impl to use
* @see CompressionMode * @see CompressionMode
* @see CompressingStoredFieldsIndex * @see CompressingStoredFieldsIndex
*/ */
public CompressingStoredFieldsFormat(CompressionMode compressionMode, int chunkSize, public CompressingStoredFieldsFormat(CompressionMode compressionMode, int chunkSize,
CompressingStoredFieldsIndex storedFieldsIndexFormat) { CompressingStoredFieldsIndex storedFieldsIndex) {
this.compressionMode = compressionMode; this.compressionMode = compressionMode;
if (chunkSize < 1) { if (chunkSize < 1) {
throw new IllegalArgumentException("chunkSize must be >= 1"); throw new IllegalArgumentException("chunkSize must be >= 1");
} }
this.chunkSize = chunkSize; this.chunkSize = chunkSize;
this.storedFieldsIndexFormat = storedFieldsIndexFormat; this.storedFieldsIndex = storedFieldsIndex;
} }
/** /**
@ -115,7 +115,13 @@ public class CompressingStoredFieldsFormat extends StoredFieldsFormat {
public StoredFieldsWriter fieldsWriter(Directory directory, SegmentInfo si, public StoredFieldsWriter fieldsWriter(Directory directory, SegmentInfo si,
IOContext context) throws IOException { IOContext context) throws IOException {
return new CompressingStoredFieldsWriter(directory, si, context, return new CompressingStoredFieldsWriter(directory, si, context,
compressionMode, chunkSize, storedFieldsIndexFormat); compressionMode, chunkSize, storedFieldsIndex);
}
@Override
public String toString() {
return getClass().getSimpleName() + "(compressionMode=" + compressionMode
+ ", chunkSize=" + chunkSize + ", storedFieldsIndex=" + storedFieldsIndex + ")";
} }
} }

View File

@ -61,4 +61,9 @@ public class CompressingCodec extends FilterCodec {
public StoredFieldsFormat storedFieldsFormat() { public StoredFieldsFormat storedFieldsFormat() {
return storedFieldsFormat; return storedFieldsFormat;
} }
@Override
public String toString() {
return getName() + "(storedFieldsFormat=" + storedFieldsFormat + ")";
}
} }