mirror of https://github.com/apache/lucene.git
LUCENE-10424: Optimize the "everything matches" case for count query in PointRangeQuery (#691)
This commit is contained in:
parent
76c9fd4e38
commit
36a2149d43
|
@ -232,6 +232,8 @@ Optimizations
|
|||
|
||||
* LUCENE-10408 Better encoding of doc Ids in vectors. (Mayya Sharipova, Julie Tibshirani, Adrien Grand)
|
||||
|
||||
* LUCENE-10424 Optimize the "everything matches" case for count query in PointRangeQuery. (Ignacio Vera, Lu Xugang)
|
||||
|
||||
* LUCENE-10084: Rewrite DocValuesFieldExistsQuery to MatchAllDocsQuery whenever terms
|
||||
or points have a docCount that is equal to maxDoc. (Vigya Sharma)
|
||||
|
||||
|
|
|
@ -391,6 +391,10 @@ public abstract class PointRangeQuery extends Query {
|
|||
&& numDims == 1
|
||||
&& values.getDocCount() == values.size()) {
|
||||
// if all documents have at-most one point
|
||||
if (relate(values.getMinPackedValue(), values.getMaxPackedValue())
|
||||
== Relation.CELL_INSIDE_QUERY) {
|
||||
return values.getDocCount();
|
||||
}
|
||||
return (int) pointCount(values.getPointTree(), this::relate, this::matches);
|
||||
}
|
||||
return super.count(context);
|
||||
|
|
Loading…
Reference in New Issue