mirror of https://github.com/apache/lucene.git
Small tweak to IntervalQuery#visit logic (#1007)
This commit is contained in:
parent
11e7fe6618
commit
a35dee5b27
|
@ -138,6 +138,9 @@ Optimizations
|
|||
|
||||
* LUCENE-10657: CopyBytes now saves one memory copy on ByteBuffersDataOutput. (luyuncheng)
|
||||
|
||||
* GITHUB#1007: Optimize IntersectVisitor#visit implementations for certain bulk-add cases.
|
||||
(Greg Miller)
|
||||
|
||||
Changes in runtime behavior
|
||||
---------------------
|
||||
|
||||
|
|
|
@ -271,10 +271,7 @@ final class LatLonPointDistanceQuery extends Query {
|
|||
@Override
|
||||
public void visit(DocIdSetIterator iterator, byte[] packedValue) throws IOException {
|
||||
if (matches(packedValue)) {
|
||||
int docID;
|
||||
while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
visit(docID);
|
||||
}
|
||||
adder.add(iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -311,10 +308,7 @@ final class LatLonPointDistanceQuery extends Query {
|
|||
@Override
|
||||
public void visit(DocIdSetIterator iterator, byte[] packedValue) throws IOException {
|
||||
if (matches(packedValue) == false) {
|
||||
int docID;
|
||||
while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
visit(docID);
|
||||
}
|
||||
visit(iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -481,10 +481,7 @@ public abstract class RangeFieldQuery extends Query {
|
|||
@Override
|
||||
public void visit(DocIdSetIterator iterator, byte[] leaf) throws IOException {
|
||||
if (queryType.matches(ranges, leaf, numDims, bytesPerDim)) {
|
||||
int docID;
|
||||
while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
visit(docID);
|
||||
}
|
||||
adder.add(iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -437,10 +437,7 @@ abstract class SpatialQuery extends Query {
|
|||
@Override
|
||||
public void visit(DocIdSetIterator iterator, byte[] t) throws IOException {
|
||||
if (leafPredicate.test(t)) {
|
||||
int docID;
|
||||
while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
visit(docID);
|
||||
}
|
||||
adder.add(iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -486,10 +483,7 @@ abstract class SpatialQuery extends Query {
|
|||
@Override
|
||||
public void visit(DocIdSetIterator iterator, byte[] t) throws IOException {
|
||||
if (leafPredicate.test(t)) {
|
||||
int docID;
|
||||
while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
visit(docID);
|
||||
}
|
||||
visit(iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -539,14 +533,10 @@ abstract class SpatialQuery extends Query {
|
|||
|
||||
@Override
|
||||
public void visit(DocIdSetIterator iterator, byte[] t) throws IOException {
|
||||
boolean matches = leafPredicate.test(t);
|
||||
int docID;
|
||||
while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
if (matches) {
|
||||
visit(docID);
|
||||
} else {
|
||||
excluded.set(docID);
|
||||
}
|
||||
if (leafPredicate.test(t)) {
|
||||
visit(iterator);
|
||||
} else {
|
||||
excluded.or(iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -653,10 +643,7 @@ abstract class SpatialQuery extends Query {
|
|||
@Override
|
||||
public void visit(DocIdSetIterator iterator, byte[] t) throws IOException {
|
||||
if (leafPredicate.test(t) == false) {
|
||||
int docID;
|
||||
while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
visit(docID);
|
||||
}
|
||||
visit(iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,10 +104,7 @@ final class XYPointInGeometryQuery extends Query {
|
|||
double x = XYEncodingUtils.decode(packedValue, 0);
|
||||
double y = XYEncodingUtils.decode(packedValue, Integer.BYTES);
|
||||
if (tree.contains(x, y)) {
|
||||
int docID;
|
||||
while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
visit(docID);
|
||||
}
|
||||
adder.add(iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -252,10 +252,7 @@ public abstract class PointInSetQuery extends Query implements Accountable {
|
|||
@Override
|
||||
public void visit(DocIdSetIterator iterator, byte[] packedValue) throws IOException {
|
||||
if (matches(packedValue)) {
|
||||
int docID;
|
||||
while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
visit(docID);
|
||||
}
|
||||
adder.add(iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -360,10 +357,7 @@ public abstract class PointInSetQuery extends Query implements Accountable {
|
|||
assert packedValue.length == pointBytes.length;
|
||||
if (Arrays.equals(packedValue, pointBytes)) {
|
||||
// The point for this set of docs matches the point we are querying on
|
||||
int docID;
|
||||
while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
visit(docID);
|
||||
}
|
||||
adder.add(iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -195,10 +195,7 @@ public abstract class PointRangeQuery extends Query {
|
|||
@Override
|
||||
public void visit(DocIdSetIterator iterator, byte[] packedValue) throws IOException {
|
||||
if (matches(packedValue)) {
|
||||
int docID;
|
||||
while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
visit(docID);
|
||||
}
|
||||
adder.add(iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,10 +232,7 @@ public abstract class PointRangeQuery extends Query {
|
|||
@Override
|
||||
public void visit(DocIdSetIterator iterator, byte[] packedValue) throws IOException {
|
||||
if (matches(packedValue) == false) {
|
||||
int docID;
|
||||
while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
visit(docID);
|
||||
}
|
||||
visit(iterator);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue