mirror of https://github.com/apache/lucene.git
Simplify the logic of matchAll() in IndexSortSortedNumericDocValuesRangeQuery (#11884)
* Simplify the logic of matchAll() in IndexSortSortedNumericDocValuesRangeQuery
This commit is contained in:
parent
48aad5090f
commit
a8120bcb32
|
@ -158,6 +158,8 @@ Optimizations
|
|||
* GITHUB#11876: Use ByteArrayComparator to speed up PointInSetQuery in single dimension case.
|
||||
(Guo Feng)
|
||||
|
||||
* GITHUB#11884: Simplify the logic of matchAll() in IndexSortSortedNumericDocValuesRangeQuery. (Lu Xugang)
|
||||
|
||||
Other
|
||||
---------------------
|
||||
|
||||
|
|
|
@ -298,19 +298,13 @@ public class IndexSortSortedNumericDocValuesRangeQuery extends Query {
|
|||
ArrayUtil.getUnsignedComparator(points.getBytesPerDimension());
|
||||
for (int dim = 0; dim < points.getNumDimensions(); dim++) {
|
||||
int offset = dim * points.getBytesPerDimension();
|
||||
if (comparator.compare(points.getMinPackedValue(), offset, queryUpperPoint, offset) > 0) {
|
||||
return false;
|
||||
}
|
||||
if (comparator.compare(points.getMaxPackedValue(), offset, queryLowerPoint, offset) < 0) {
|
||||
return false;
|
||||
}
|
||||
if (comparator.compare(points.getMinPackedValue(), offset, queryLowerPoint, offset) < 0
|
||||
|| comparator.compare(points.getMaxPackedValue(), offset, queryUpperPoint, offset) > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (comparator.compare(points.getMinPackedValue(), offset, queryLowerPoint, offset) >= 0
|
||||
&& comparator.compare(points.getMaxPackedValue(), offset, queryUpperPoint, offset) <= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private BoundedDocIdSetIterator getDocIdSetIteratorOrNullFromBkd(
|
||||
LeafReaderContext context, DocIdSetIterator delegate) throws IOException {
|
||||
|
|
|
@ -688,6 +688,13 @@ public class TestIndexSortSortedNumericDocValuesRangeQuery extends LuceneTestCas
|
|||
assertEquals(2500, weight.count(context));
|
||||
}
|
||||
|
||||
fallbackQuery = LongPoint.newRangeQuery(filedName, 5, 9);
|
||||
query = new IndexSortSortedNumericDocValuesRangeQuery(filedName, 2, 10, fallbackQuery);
|
||||
weight = query.createWeight(searcher, ScoreMode.COMPLETE, 1.0f);
|
||||
for (LeafReaderContext context : searcher.getLeafContexts()) {
|
||||
assertEquals(2500, weight.count(context));
|
||||
}
|
||||
|
||||
fallbackQuery = LongPoint.newRangeQuery(filedName, 2, 3);
|
||||
query = new IndexSortSortedNumericDocValuesRangeQuery(filedName, 2, 3, fallbackQuery);
|
||||
weight = query.createWeight(searcher, ScoreMode.COMPLETE, 1.0f);
|
||||
|
|
Loading…
Reference in New Issue