Skip to content

Commit

Permalink
old segments not readable by new storedfieldsformat
Browse files Browse the repository at this point in the history
Signed-off-by: Sarthak Aggarwal <[email protected]>
  • Loading branch information
sarthakaggarwal97 committed Jan 26, 2024
1 parent 5b40132 commit a3fdc2a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,7 @@ public Lucene99CoreStoredFieldsFormat(Lucene99Codec.Mode mode) {
*/
@Override
public StoredFieldsReader fieldsReader(Directory directory, SegmentInfo si, FieldInfos fn, IOContext context) throws IOException {

if (si.getAttribute(Lucene90StoredFieldsFormat.MODE_KEY) != null) {
String value = si.getAttribute(Lucene90StoredFieldsFormat.MODE_KEY);
Lucene90StoredFieldsFormat.Mode mode = Lucene90StoredFieldsFormat.Mode.valueOf(value);
return impl(mode).fieldsReader(directory, si, fn, context);
} else if (si.getAttribute(MODE_KEY) != null) {
if (si.getAttribute(MODE_KEY) != null) {
String value = si.getAttribute(MODE_KEY);
Lucene99Codec.Mode mode = Lucene99Codec.Mode.valueOf(value);
return impl(mode).fieldsReader(directory, si, fn, context);
Expand All @@ -79,17 +74,6 @@ public StoredFieldsReader fieldsReader(Directory directory, SegmentInfo si, Fiel

}

private StoredFieldsFormat impl(Lucene90StoredFieldsFormat.Mode mode) {
switch (mode) {
case BEST_SPEED:
return getLZ4CompressingStoredFieldsFormat();
case BEST_COMPRESSION:
return getZlibCompressingStoredFieldsFormat();
default:
throw new AssertionError();
}
}

/**
* Returns a {@link StoredFieldsReader} to write stored fields.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import org.apache.logging.log4j.LogManager;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.lucene90.Lucene90StoredFieldsFormat;
import org.apache.lucene.codecs.lucene99.Lucene99Codec;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.DirectoryReader;
Expand Down

0 comments on commit a3fdc2a

Please sign in to comment.