public class GeoPointInBBoxQuery extends Query
LegacyNumericRangeQuery
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.
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
field name
|
protected double |
maxLat
maximum latitude value (in degrees)
|
protected double |
maxLon
maximum longitude value (in degrees)
|
protected double |
minLat
minimum latitude value (in degrees)
|
protected double |
minLon
minimum longitude value (in degrees)
|
protected GeoPointField.TermEncoding |
termEncoding
term encoding enum to define how the points are encoded (PREFIX or NUMERIC)
|
Constructor and Description |
---|
GeoPointInBBoxQuery(String field,
double minLat,
double maxLat,
double minLon,
double maxLon)
Constructs a query for all
GeoPointField types that fall within a
defined bounding box |
GeoPointInBBoxQuery(String field,
GeoPointField.TermEncoding termEncoding,
double minLat,
double maxLat,
double minLon,
double maxLon)
Constructs a query for all
GeoPointField types that fall within a
defined bounding box. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
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) |
classHash, createWeight, sameClassAs, toString
protected final String field
protected final double minLat
protected final double minLon
protected final double maxLat
protected final double maxLon
protected final GeoPointField.TermEncoding termEncoding
public GeoPointInBBoxQuery(String field, double minLat, double maxLat, double minLon, double maxLon)
GeoPointField
types that fall within a
defined bounding boxpublic GeoPointInBBoxQuery(String field, GeoPointField.TermEncoding termEncoding, double minLat, double maxLat, double minLon, double maxLon)
GeoPointField
types that fall within a
defined bounding box. Accepts optional GeoPointField.TermEncoding
parameterpublic Query rewrite(IndexReader reader)
public final String getField()
public final double getMinLat()
public final double getMaxLat()
public final double getMinLon()
public final double getMaxLon()
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.