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.
|
* GITHUB#11876: Use ByteArrayComparator to speed up PointInSetQuery in single dimension case.
|
||||||
(Guo Feng)
|
(Guo Feng)
|
||||||
|
|
||||||
|
* GITHUB#11884: Simplify the logic of matchAll() in IndexSortSortedNumericDocValuesRangeQuery. (Lu Xugang)
|
||||||
|
|
||||||
Other
|
Other
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|
|
@ -298,18 +298,12 @@ public class IndexSortSortedNumericDocValuesRangeQuery extends Query {
|
||||||
ArrayUtil.getUnsignedComparator(points.getBytesPerDimension());
|
ArrayUtil.getUnsignedComparator(points.getBytesPerDimension());
|
||||||
for (int dim = 0; dim < points.getNumDimensions(); dim++) {
|
for (int dim = 0; dim < points.getNumDimensions(); dim++) {
|
||||||
int offset = dim * points.getBytesPerDimension();
|
int offset = dim * points.getBytesPerDimension();
|
||||||
if (comparator.compare(points.getMinPackedValue(), offset, queryUpperPoint, offset) > 0) {
|
if (comparator.compare(points.getMinPackedValue(), offset, queryLowerPoint, offset) >= 0
|
||||||
return false;
|
&& comparator.compare(points.getMaxPackedValue(), offset, queryUpperPoint, offset) <= 0) {
|
||||||
}
|
return true;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BoundedDocIdSetIterator getDocIdSetIteratorOrNullFromBkd(
|
private BoundedDocIdSetIterator getDocIdSetIteratorOrNullFromBkd(
|
||||||
|
|
|
@ -688,6 +688,13 @@ public class TestIndexSortSortedNumericDocValuesRangeQuery extends LuceneTestCas
|
||||||
assertEquals(2500, weight.count(context));
|
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);
|
fallbackQuery = LongPoint.newRangeQuery(filedName, 2, 3);
|
||||||
query = new IndexSortSortedNumericDocValuesRangeQuery(filedName, 2, 3, fallbackQuery);
|
query = new IndexSortSortedNumericDocValuesRangeQuery(filedName, 2, 3, fallbackQuery);
|
||||||
weight = query.createWeight(searcher, ScoreMode.COMPLETE, 1.0f);
|
weight = query.createWeight(searcher, ScoreMode.COMPLETE, 1.0f);
|
||||||
|
|
Loading…
Reference in New Issue