mirror of https://github.com/apache/lucene.git
count() in BooleanQuery could be early quit (#11895)
* Count() in BooleanQuery could be early quit if queries are pure disjunctional
This commit is contained in:
parent
69a7cb22e7
commit
e5426dbbd2
|
@ -163,6 +163,8 @@ Optimizations
|
|||
|
||||
* GITHUB#11884: Simplify the logic of matchAll() in IndexSortSortedNumericDocValuesRangeQuery. (Lu Xugang)
|
||||
|
||||
* GITHUB#11895: count() in BooleanQuery could be early quit. (Lu Xugang)
|
||||
|
||||
Other
|
||||
---------------------
|
||||
|
||||
|
|
|
@ -401,8 +401,9 @@ final class BooleanWeight extends Weight {
|
|||
final int numDocs = context.reader().numDocs();
|
||||
int positiveCount;
|
||||
if (query.isPureDisjunction()) {
|
||||
positiveCount = optCount(context, Occur.SHOULD);
|
||||
} else if ((query.getClauses(Occur.FILTER).isEmpty() == false
|
||||
return optCount(context, Occur.SHOULD);
|
||||
}
|
||||
if ((query.getClauses(Occur.FILTER).isEmpty() == false
|
||||
|| query.getClauses(Occur.MUST).isEmpty() == false)
|
||||
&& query.getMinimumNumberShouldMatch() == 0) {
|
||||
positiveCount = reqCount(context);
|
||||
|
|
Loading…
Reference in New Issue