mirror of https://github.com/apache/lucene.git
LUCENE-8955: Move compare logic to IntersectVisitor in NearestNeighbor (#842)
This commit is contained in:
parent
0ad8c1f302
commit
ff1e2fa658
|
@ -88,8 +88,11 @@ Improvements
|
|||
|
||||
* LUCENE-8894: Add APIs to find SPI names for Tokenizer/CharFilter/TokenFilter factory classes. (Tomoko Uchida)
|
||||
|
||||
* LUCENE-8914: move the logic for discarding inner modes to the IntersectVisitor so we take advantage
|
||||
of the change introduced in LUCENE-7862. (Ignacio Vera)
|
||||
* LUCENE-8914: move the logic for discarding inner modes in FloatPointNearestNeighbor to the IntersectVisitor
|
||||
so we take advantage of the change introduced in LUCENE-7862. (Ignacio Vera)
|
||||
|
||||
* LUCENE-8955: move the logic for discarding inner modes in LatLonPoint NearestNeighbor to the IntersectVisitor
|
||||
so we take advantage of the change introduced in LUCENE-7862. (Ignacio Vera)
|
||||
|
||||
* LUCENE-8918: PhraseQuery throws exceptions at construction time if it is passed
|
||||
null arguments. (Alan Woodward)
|
||||
|
|
|
@ -182,6 +182,15 @@ class NearestNeighbor {
|
|||
|
||||
@Override
|
||||
public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
|
||||
double cellMinLat = decodeLatitude(minPackedValue, 0);
|
||||
double cellMinLon = decodeLongitude(minPackedValue, Integer.BYTES);
|
||||
double cellMaxLat = decodeLatitude(maxPackedValue, 0);
|
||||
double cellMaxLon = decodeLongitude(maxPackedValue, Integer.BYTES);
|
||||
|
||||
if (cellMaxLat < minLat || maxLat < cellMinLat || ((cellMaxLon < minLon || maxLon < cellMinLon) && cellMaxLon < minLon2)) {
|
||||
// this cell is outside our search bbox; don't bother exploring any more
|
||||
return Relation.CELL_OUTSIDE_QUERY;
|
||||
}
|
||||
return Relation.CELL_CROSSES_QUERY;
|
||||
}
|
||||
}
|
||||
|
@ -266,13 +275,7 @@ class NearestNeighbor {
|
|||
//System.out.println(" non-leaf");
|
||||
// Non-leaf block: split into two cells and put them back into the queue:
|
||||
|
||||
double cellMinLat = decodeLatitude(cell.minPacked, 0);
|
||||
double cellMinLon = decodeLongitude(cell.minPacked, Integer.BYTES);
|
||||
double cellMaxLat = decodeLatitude(cell.maxPacked, 0);
|
||||
double cellMaxLon = decodeLongitude(cell.maxPacked, Integer.BYTES);
|
||||
|
||||
if (cellMaxLat < visitor.minLat || visitor.maxLat < cellMinLat || ((cellMaxLon < visitor.minLon || visitor.maxLon < cellMinLon) && cellMaxLon < visitor.minLon2)) {
|
||||
// this cell is outside our search bbox; don't bother exploring any more
|
||||
if (visitor.compare(cell.minPacked, cell.maxPacked) == Relation.CELL_OUTSIDE_QUERY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue