mirror of https://github.com/apache/lucene.git
Add bw tests for block-tree with inlined metadata. (#13527)
The backport of #13524 found a hole in the testing of `Lucene40BlockTreeTerms` for versions before we moved metadata to its own file. This PR adds explicit bw testing for this version. Adding the correct if/else statements made the code extremely complicated so I opted for restoring the file as it was at the time when we bumped the version. This also fixes the bug that we introduced in #13524.
This commit is contained in:
parent
f8ee339f64
commit
44ad4d95c6
|
@ -93,6 +93,8 @@ public final class FieldReader extends Terms {
|
|||
final IndexInput clone = indexIn.clone();
|
||||
clone.seek(indexStartFP);
|
||||
fstMetadata = readMetadata(clone, ByteSequenceOutputs.getSingleton());
|
||||
// FST bytes actually only start after the metadata.
|
||||
indexStartFP = clone.getFilePointer();
|
||||
} else {
|
||||
fstMetadata = readMetadata(metaIn, ByteSequenceOutputs.getSingleton());
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,7 +17,7 @@
|
|||
package org.apache.lucene.backward_codecs.lucene50;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.apache.lucene.backward_codecs.lucene40.blocktree.Lucene40BlockTreeTermsWriter;
|
||||
import org.apache.lucene.backward_codecs.lucene40.blocktree.Lucene40BlockTreeTermsWriterV5;
|
||||
import org.apache.lucene.codecs.FieldsConsumer;
|
||||
import org.apache.lucene.codecs.PostingsWriterBase;
|
||||
import org.apache.lucene.index.SegmentWriteState;
|
||||
|
@ -31,11 +31,11 @@ public class Lucene50RWPostingsFormat extends Lucene50PostingsFormat {
|
|||
boolean success = false;
|
||||
try {
|
||||
FieldsConsumer ret =
|
||||
new Lucene40BlockTreeTermsWriter(
|
||||
new Lucene40BlockTreeTermsWriterV5(
|
||||
state,
|
||||
postingsWriter,
|
||||
Lucene40BlockTreeTermsWriter.DEFAULT_MIN_BLOCK_SIZE,
|
||||
Lucene40BlockTreeTermsWriter.DEFAULT_MAX_BLOCK_SIZE);
|
||||
Lucene40BlockTreeTermsWriterV5.DEFAULT_MIN_BLOCK_SIZE,
|
||||
Lucene40BlockTreeTermsWriterV5.DEFAULT_MAX_BLOCK_SIZE);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
|
|
|
@ -196,6 +196,7 @@ public class TestAncientIndicesCompatibility extends LuceneTestCase {
|
|||
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
|
||||
CheckIndex checker = new CheckIndex(dir);
|
||||
checker.setInfoStream(new PrintStream(bos, false, UTF_8));
|
||||
checker.setLevel(CheckIndex.Level.MIN_LEVEL_FOR_INTEGRITY_CHECKS);
|
||||
CheckIndex.Status indexStatus = checker.checkIndex();
|
||||
if (version.startsWith("8.")) {
|
||||
assertTrue(indexStatus.clean);
|
||||
|
|
Loading…
Reference in New Issue