org.apache.lucene.spatial.geopoint.search

Class GeoPointInBBoxQuery

  • Direct Known Subclasses:
    GeoPointDistanceQuery, GeoPointInPolygonQuery


    public class GeoPointInBBoxQuery
    extends Query
    Implements a simple bounding box query on a GeoPoint field. This is inspired by 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)
    • Field Detail

      • minLat

        protected final double minLat
        minimum latitude value (in degrees)
      • minLon

        protected final double minLon
        minimum longitude value (in degrees)
      • maxLat

        protected final double maxLat
        maximum latitude value (in degrees)
      • maxLon

        protected final double maxLon
        maximum longitude value (in degrees)
    • Method Detail

      • rewrite

        public Query rewrite(IndexReader reader)
        Description copied from class: Query
        Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.
        Overrides:
        rewrite in class Query
      • toString

        public String toString(String field)
        Description copied from class: Query
        Prints a query to a string, with field assumed to be the default field and omitted.
        Specified by:
        toString in class Query
      • equals

        public boolean equals(Object other)
        Description copied from class: Query
        Override and implement query instance equivalence properly in a subclass. This is required so that QueryCache works properly. Typically a query will be equal to another only if it's an instance of the same class and its document-filtering properties are identical that other instance. Utility methods are provided for certain repetitive code.
        Specified by:
        equals in class Query
        See Also:
        Query.sameClassAs(Object), Query.classHash()
      • getField

        public final String getField()
        getter method for retrieving the field name
      • getMinLat

        public final double getMinLat()
        getter method for retrieving the minimum latitude (in degrees)
      • getMaxLat

        public final double getMaxLat()
        getter method for retrieving the maximum latitude (in degrees)
      • getMinLon

        public final double getMinLon()
        getter method for retrieving the minimum longitude (in degrees)
      • getMaxLon

        public final double getMaxLon()
        getter method for retrieving the maximum longitude (in degrees)