mirror of https://github.com/apache/lucene.git
LUCENE-10464, LUCENE-10477: WeightedSpanTermExtractor.extractWeightedSpanTerms to rewrite sufficiently (#737)
This commit is contained in:
parent
28d3adcf69
commit
ca252d6621
|
@ -75,7 +75,8 @@ Optimizations
|
|||
|
||||
Bug Fixes
|
||||
---------------------
|
||||
(No changes)
|
||||
* LUCENE-10477: Highlighter: WeightedSpanTermExtractor.extractWeightedSpanTerms to Query#rewrite
|
||||
multiple times if necessary. (Christine Poerschke, Adrien Grand)
|
||||
|
||||
Other
|
||||
---------------------
|
||||
|
|
|
@ -309,11 +309,11 @@ public class WeightedSpanTermExtractor {
|
|||
final IndexSearcher searcher = new IndexSearcher(getLeafContext());
|
||||
searcher.setQueryCache(null);
|
||||
if (mustRewriteQuery) {
|
||||
final SpanQuery rewrittenQuery = (SpanQuery) searcher.rewrite(spanQuery);
|
||||
for (final String field : fieldNames) {
|
||||
final SpanQuery rewrittenQuery = (SpanQuery) spanQuery.rewrite(getLeafContext().reader());
|
||||
queries.put(field, rewrittenQuery);
|
||||
rewrittenQuery.visit(QueryVisitor.termCollector(nonWeightedTerms));
|
||||
}
|
||||
rewrittenQuery.visit(QueryVisitor.termCollector(nonWeightedTerms));
|
||||
} else {
|
||||
spanQuery.visit(QueryVisitor.termCollector(nonWeightedTerms));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue