mirror of https://github.com/apache/lucene.git
SuggestIndexSearcher.suggest catches any CollectionTerminatedException (theoretically) thrown by getLeafCollector (#12609)
This commit is contained in:
parent
e02f1b1d29
commit
411b7fd518
|
@ -68,8 +68,9 @@ public class SuggestIndexSearcher extends IndexSearcher {
|
|||
for (LeafReaderContext context : getIndexReader().leaves()) {
|
||||
BulkScorer scorer = weight.bulkScorer(context);
|
||||
if (scorer != null) {
|
||||
LeafCollector leafCollector = collector.getLeafCollector(context);
|
||||
LeafCollector leafCollector = null;
|
||||
try {
|
||||
leafCollector = collector.getLeafCollector(context);
|
||||
scorer.score(leafCollector, context.reader().getLiveDocs());
|
||||
} catch (
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -77,7 +78,9 @@ public class SuggestIndexSearcher extends IndexSearcher {
|
|||
// collection was terminated prematurely
|
||||
// continue with the following leaf
|
||||
}
|
||||
leafCollector.finish();
|
||||
if (leafCollector != null) {
|
||||
leafCollector.finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue