public class GeoPointInBBoxQuery extends Query
NumericRangeQuery
and is implemented using a
two phase approach. First, candidate terms are queried using a numeric
range based on the morton codes of the min and max lat/lon pairs. Terms
passing this initial filter are passed to a final check that verifies whether
the decoded lat/lon falls within (or on the boundary) of the query bounding box.
The value comparisons are subject to a precision tolerance defined in
1.0E-6
NOTES:
1. All latitude/longitude values must be in decimal degrees.
2. Complex computational geometry (e.g., dateline wrapping) is not supported
3. For more advanced GeoSpatial indexing and query operations see spatial module
4. This is well suited for small rectangles, large bounding boxes may result
in many terms, depending whether the bounding box falls on the boundary of
many cells (degenerate case)Modifier and Type | Field and Description |
---|---|
protected String |
field |
protected double |
maxLat |
protected double |
maxLon |
protected double |
minLat |
protected double |
minLon |
protected GeoPointField.TermEncoding |
termEncoding |
Constructor and Description |
---|
GeoPointInBBoxQuery(String field,
double minLon,
double minLat,
double maxLon,
double maxLat)
Constructs a query for all
GeoPointField types that fall within a
defined bounding box |
GeoPointInBBoxQuery(String field,
GeoPointField.TermEncoding termEncoding,
double minLon,
double minLat,
double maxLon,
double maxLat) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
String |
getField()
getter method for retrieving the field name
|
double |
getMaxLat()
getter method for retrieving the maximum latitude (in degrees)
|
double |
getMaxLon()
getter method for retrieving the maximum longitude (in degrees)
|
double |
getMinLat()
getter method for retrieving the minimum latitude (in degrees)
|
double |
getMinLon()
getter method for retrieving the minimum longitude (in degrees)
|
int |
hashCode() |
Query |
rewrite(IndexReader reader) |
String |
toString(String field) |
protected final String field
protected final double minLon
protected final double minLat
protected final double maxLon
protected final double maxLat
protected final GeoPointField.TermEncoding termEncoding
public GeoPointInBBoxQuery(String field, double minLon, double minLat, double maxLon, double maxLat)
GeoPointField
types that fall within a
defined bounding boxpublic GeoPointInBBoxQuery(String field, GeoPointField.TermEncoding termEncoding, double minLon, double minLat, double maxLon, double maxLat)
public Query rewrite(IndexReader reader) throws IOException
rewrite
in class Query
IOException
public final String getField()
public final double getMinLon()
public final double getMinLat()
public final double getMaxLon()
public final double getMaxLat()
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.