You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2025/02/21 18:15:16 UTC
(lucene) branch branch_10x updated: Stop cloning index input when loading NRTSuggester (#14271)
This is an automated email from the ASF dual-hosted git repository.
javanna pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/branch_10x by this push:
new f2e468b0744 Stop cloning index input when loading NRTSuggester (#14271)
f2e468b0744 is described below
commit f2e468b074420d6b4640a0945a23e064e6e015da
Author: Luca Cavanna <ja...@apache.org>
AuthorDate: Fri Feb 21 19:02:25 2025 +0100
Stop cloning index input when loading NRTSuggester (#14271)
Cloning the index input is not necessary when loading the NRTSUggester. Also,
it causes a bug as the clone gets closed right before the suggester instance
gets returned, which makes it unusable in the later lookup method which slices
the index input while it's already closed.
This was not discovered so far due to a testing gap that is fixed by #14270
---
lucene/CHANGES.txt | 1 +
.../lucene/search/suggest/document/CompletionsTermsReader.java | 6 ++----
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 53f6abecbfb..af99535fde5 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -245,6 +245,7 @@ Bug Fixes
* GITHUB#14008: Counts provided by taxonomy facets in addition to another aggregation are now returned together with
their corresponding ordinals. (Paul King)
* GITHUB#14027: Make SegmentInfos#readCommit(Directory, String, int) public (Luca Cavanna)
+* GITHUB#14271: Stop closing index input when loading NRTSuggester (Luca Cavanna)
Build
---------------------
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionsTermsReader.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionsTermsReader.java
index 9aac363b2d0..f8e22256f75 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionsTermsReader.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/CompletionsTermsReader.java
@@ -72,10 +72,8 @@ public final class CompletionsTermsReader implements Accountable {
*/
public synchronized NRTSuggester suggester() throws IOException {
if (suggester == null) {
- try (IndexInput dictClone = dictIn.clone()) { // let multiple fields load concurrently
- dictClone.seek(offset);
- suggester = NRTSuggester.load(dictClone, fstLoadMode);
- }
+ IndexInput indexInput = dictIn.slice("NRTSuggester", offset, dictIn.length() - offset);
+ suggester = NRTSuggester.load(indexInput, fstLoadMode);
}
return suggester;
}