mirror of https://github.com/apache/lucene.git
LUCENE-10439: Support multi-valued and multiple dimensions for count query in PointRangeQuery (#705)
This commit is contained in:
parent
b0ca227862
commit
550d1305db
|
@ -387,15 +387,18 @@ public abstract class PointRangeQuery extends Query {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (reader.hasDeletions() == false
|
||||
&& numDims == 1
|
||||
&& values.getDocCount() == values.size()) {
|
||||
// if all documents have at-most one point
|
||||
if (reader.hasDeletions() == false) {
|
||||
if (relate(values.getMinPackedValue(), values.getMaxPackedValue())
|
||||
== Relation.CELL_INSIDE_QUERY) {
|
||||
return values.getDocCount();
|
||||
}
|
||||
return (int) pointCount(values.getPointTree(), this::relate, this::matches);
|
||||
// only 1D: we have the guarantee that it will actually run fast since there are at most 2
|
||||
// crossing leaves.
|
||||
// docCount == size : counting according number of points in leaf node, so must be
|
||||
// single-valued.
|
||||
if (numDims == 1 && values.getDocCount() == values.size()) {
|
||||
return (int) pointCount(values.getPointTree(), this::relate, this::matches);
|
||||
}
|
||||
}
|
||||
return super.count(context);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue