#12901: add TestBackwardsCompatibility test case that reveals the block tree IntersectTermsEnum bug #12895 (#12913)

* #12901: add TestBackwardsCompatibility test case that reveals the block tree IntersectTermsEnum bug #12895

* woops, forgot to tidy up

* #12901: Ignore failing test; reflow text to workaround spotless' poor text formatting skills
This commit is contained in:
Michael McCandless 2023-12-11 05:51:43 -08:00 committed by Mike McCandless
parent 069c048770
commit af11ea2562
2 changed files with 22 additions and 0 deletions

View File

@ -109,6 +109,7 @@ import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortField;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.search.WildcardQuery;
import org.apache.lucene.store.ByteBuffersDirectory;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
@ -127,6 +128,7 @@ import org.apache.lucene.util.InfoStream;
import org.apache.lucene.util.Version;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
/*
Verify we can read previous versions' indexes, do searches
@ -2240,6 +2242,26 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
}
}
// #12895: test on a carefully crafted 9.8.0 index (from a small contiguous subset
// of wikibigall unique terms) that shows the read-time exception of
// IntersectTermsEnum (used by WildcardQuery)
@Ignore("re-enable once we merge #12900")
public void testWildcardQueryExceptions990() throws IOException {
Path path = createTempDir("12895");
String name = "index.12895.9.8.0.zip";
InputStream resource = TestBackwardsCompatibility.class.getResourceAsStream(name);
assertNotNull("missing zip file to reproduce #12895", resource);
TestUtil.unzip(resource, path);
try (Directory dir = newFSDirectory(path);
DirectoryReader reader = DirectoryReader.open(dir)) {
IndexSearcher searcher = new IndexSearcher(reader);
searcher.count(new WildcardQuery(new Term("field", "*qx*")));
}
}
@Nightly
public void testReadNMinusTwoCommit() throws IOException {
for (String name : binarySupportedNames) {