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,16 +387,19 @@ public abstract class PointRangeQuery extends Query {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reader.hasDeletions() == false
|
if (reader.hasDeletions() == false) {
|
||||||
&& numDims == 1
|
|
||||||
&& values.getDocCount() == values.size()) {
|
|
||||||
// if all documents have at-most one point
|
|
||||||
if (relate(values.getMinPackedValue(), values.getMaxPackedValue())
|
if (relate(values.getMinPackedValue(), values.getMaxPackedValue())
|
||||||
== Relation.CELL_INSIDE_QUERY) {
|
== Relation.CELL_INSIDE_QUERY) {
|
||||||
return values.getDocCount();
|
return values.getDocCount();
|
||||||
}
|
}
|
||||||
|
// 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 (int) pointCount(values.getPointTree(), this::relate, this::matches);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return super.count(context);
|
return super.count(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue