mirror of
https://github.com/apache/lucene.git
synced 2025-03-01 05:49:33 +00:00
LUCENE-9443: UnifiedHighlighter shouldn't close reader (#1706)
A regression from 8.6. Don't close the underlying IndexReader.
This commit is contained in:
parent
327d860a00
commit
7d5b617973
@ -196,6 +196,13 @@ Other
|
||||
---------------------
|
||||
(No changes)
|
||||
|
||||
======================= Lucene 8.6.1 =======================
|
||||
|
||||
Bug Fixes
|
||||
---------------------
|
||||
* LUCENE-9443: The UnifiedHighlighter was closing the underlying reader when there were multiple term-vector fields.
|
||||
This was a regression in 8.6.0. (David Smiley, Chris Beer)
|
||||
|
||||
======================= Lucene 8.6.0 =======================
|
||||
|
||||
API Changes
|
||||
|
@ -644,7 +644,7 @@ public class UnifiedHighlighter {
|
||||
|
||||
batchDocIdx += fieldValsByDoc.size();
|
||||
}
|
||||
IOUtils.close(indexReaderWithTermVecCache);
|
||||
IOUtils.close(indexReaderWithTermVecCache); // FYI won't close underlying reader
|
||||
assert docIdIter.docID() == DocIdSetIterator.NO_MORE_DOCS
|
||||
|| docIdIter.nextDoc() == DocIdSetIterator.NO_MORE_DOCS;
|
||||
|
||||
@ -1087,8 +1087,7 @@ public class UnifiedHighlighter {
|
||||
.toArray(LeafReader[]::new);
|
||||
return new BaseCompositeReader<IndexReader>(leafReaders) {
|
||||
@Override
|
||||
protected void doClose() throws IOException {
|
||||
reader.close();
|
||||
protected void doClose() { // don't close the underlying reader
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -120,6 +120,7 @@ public class TestUnifiedHighlighterTermVec extends LuceneTestCase {
|
||||
assertArrayEquals(expectedSnippetsByDoc, fieldToSnippets.get(field));
|
||||
}
|
||||
|
||||
ir.document(0); // ensure this works because the ir hasn't been closed
|
||||
ir.close();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user