Apache Lucene open-source search software
#12901: add TestBackwardsCompatibility test case that reveals the block tree IntersectTermsEnum bug #12895 (#12913)
Michael McCandlessaf11ea2562d3
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.javaindex 9b8e572ff48..08ab49e94fa 100644--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java@@ -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*")));+ }+ }+@Nightlypublic void testReadNMinusTwoCommit() throws IOException {for (String name : binarySupportedNames) {diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.12895.9.8.0.zip b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.12895.9.8.0.zipnew file mode 100644index 00000000000..867afc7a7e3Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.12895.9.8.0.zip differ