public final class GeoPointDistanceQuery extends GeoPointInBBoxQuery
GeoPointInBBoxQuery and is implemented using a two phase approach. First,
like GeoPointInBBoxQueryImpl candidate terms are queried using the numeric ranges based on
the morton codes of the min and max lat/lon pairs that intersect the boundary of the point-radius
circle (see GeoUtils.lineCrossesSphere(double, double, double, double, double, double, double, double, double, double). Terms
passing this initial filter are then passed to a secondary postFilter method that verifies whether the
decoded lat/lon point fall within the specified query distance (see SloppyMath.haversin(double, double, double, double).
All morton value comparisons are subject to the same precision tolerance defined in
1.0E-6 and distance comparisons are subject to the accuracy of the
haversine formula (from R.W. Sinnott, "Virtues of the Haversine", Sky and Telescope, vol. 68, no. 2, 1984, p. 159)
Note: This query currently uses haversine which is a sloppy distance calculation (see above reference). For large
queries one can expect upwards of 400m error. Vincenty shrinks this to ~40m error but pays a penalty for computing
using the spheroid| Modifier and Type | Field and Description |
|---|---|
protected double |
centerLat |
protected double |
centerLon |
protected double |
radius |
| Constructor and Description |
|---|
GeoPointDistanceQuery(String field,
double centerLon,
double centerLat,
double radius)
NOTE: radius is in meters.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
double |
getCenterLat() |
double |
getCenterLon() |
double |
getRadius() |
int |
hashCode() |
Query |
rewrite(IndexReader reader) |
String |
toString(String field) |
getField, getMaxLat, getMaxLon, getMinLat, getMinLonprotected final double centerLon
protected final double centerLat
protected final double radius
public GeoPointDistanceQuery(String field, double centerLon, double centerLat, double radius)
public Query rewrite(IndexReader reader)
rewrite in class GeoPointInBBoxQuerypublic boolean equals(Object o)
equals in class GeoPointInBBoxQuerypublic int hashCode()
hashCode in class GeoPointInBBoxQuerypublic String toString(String field)
toString in class GeoPointInBBoxQuerypublic double getCenterLon()
public double getCenterLat()
public double getRadius()
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.