org.apache.lucene.spatial.geopoint.search

## Class GeoPointInBBoxQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.apache.lucene.spatial.geopoint.search.GeoPointInBBoxQuery

- All Implemented Interfaces:
    Cloneable
  Direct Known Subclasses:
    GeoPointDistanceQuery, GeoPointInPolygonQuery

      public class GeoPointInBBoxQuery
      extends Query

  Implements a simple bounding box query on a GeoPoint field. This is inspired by `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)
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    Fields
    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 Summary

    Constructors
    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)`

  - ### Method Summary

    Methods
    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)`

    - ### Methods inherited from class org.apache.lucene.search.Query

      `clone, createWeight, getBoost, setBoost, toString`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### field

          protected final String field

    - #### minLon

          protected final double minLon

    - #### minLat

          protected final double minLat

    - #### maxLon

          protected final double maxLon

    - #### maxLat

          protected final double maxLat

    - #### termEncoding

          protected final GeoPointField.TermEncoding termEncoding

  - ### Constructor Detail

    - #### GeoPointInBBoxQuery

          public 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

          public GeoPointInBBoxQuery(String field,
                             GeoPointField.TermEncoding termEncoding,
                             double minLon,
                             double minLat,
                             double maxLon,
                             double maxLat)

  - ### Method Detail

    - #### rewrite

          public Query rewrite(IndexReader reader)
                        throws IOException

      Overrides:
        `rewrite` in class `Query`
      Throws:
        `IOException`

    - #### toString

          public String toString(String field)

      Specified by:
        `toString` in class `Query`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Query`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Query`

    - #### getField

          public final String getField()

      getter method for retrieving the field name

    - #### getMinLon

          public final double getMinLon()

      getter method for retrieving the minimum longitude (in degrees)

    - #### getMinLat

          public final double getMinLat()

      getter method for retrieving the minimum latitude (in degrees)

    - #### getMaxLon

          public final double getMaxLon()

      getter method for retrieving the maximum longitude (in degrees)

    - #### getMaxLat

          public final double getMaxLat()

      getter method for retrieving the maximum latitude (in degrees)

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.