LUCENE-8127: Speed up rewriteNoScoring when there are no MUST clauses.

This commit is contained in:
Adrien Grand 2018-02-12 14:39:17 +01:00
parent c0f8e6075d
commit 7a38394765
2 changed files with 6 additions and 0 deletions

View File

@ -141,6 +141,9 @@ Improvements
classes to use the optimized variants through the MR-JAR mechanism.
(Uwe Schindler, Robert Muir, Adrien Grand, Mike McCandless)
* LUCENE-8127: Speed up rewriteNoScoring when there are no MUST clauses.
(Michael Braun via Adrien Grand)
Bug Fixes
* LUCENE-8077: Fixed bug in how CheckIndex verifies doc-value iterators.

View File

@ -183,6 +183,9 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
}
private BooleanQuery rewriteNoScoring() {
if (clauseSets.get(Occur.MUST).size() == 0) {
return this;
}
BooleanQuery.Builder newQuery = new BooleanQuery.Builder();
newQuery.setMinimumNumberShouldMatch(getMinimumNumberShouldMatch());
for (BooleanClause clause : clauses) {