Skip to content

Commit

Permalink
apache#12901: add TestBackwardsCompatibility test case that reveals t…
Browse files Browse the repository at this point in the history
…he block tree IntersectTermsEnum bug apache#12895
  • Loading branch information
mikemccand committed Dec 11, 2023
1 parent 0aad062 commit 9b0ed15
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
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;
Expand Down Expand Up @@ -2268,6 +2269,25 @@ public void testFailOpenOldIndex() throws IOException {
}
}

// #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)
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) {
Expand Down
Binary file not shown.

0 comments on commit 9b0ed15

Please sign in to comment.