org.apache.lucene.spatial.geopoint.search

## Class GeoPointDistanceQuery

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

- Deprecated.
  Use the higher performance `LatLonPoint.newDistanceQuery` instead.

      @Deprecated
      public class GeoPointDistanceQuery
      extends GeoPointInBBoxQuery

  Implements a simple point distance query on a GeoPoint field. This is based on `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. 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.haversinMeters(double, double, double, double)`. 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

  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 double` | `centerLat` Deprecated. latitude value (in degrees) for query location
    `protected double` | `centerLon` Deprecated. longitude value (in degrees) for query location
    `protected double` | `radiusMeters` Deprecated. distance (in meters) from lat, lon center location
    `protected double` | `sortKey` Deprecated. partial haversin computation

    - ### Fields inherited from class org.apache.lucene.spatial.geopoint.search.GeoPointInBBoxQuery

      `field, maxLat, maxLon, minLat, minLon, termEncoding`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GeoPointDistanceQuery(String field, double centerLat, double centerLon, double radiusMeters)` Deprecated. Constructs a Query for all `GeoPointField` types within a distance (in meters) from a given point
    `GeoPointDistanceQuery(String field, GeoPointField.TermEncoding termEncoding, double centerLat, double centerLon, double radiusMeters)` Deprecated. Constructs a Query for all `GeoPointField` types within a distance (in meters) from a given point.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)` Deprecated.
    `double` | `getCenterLat()` Deprecated. getter method for center latitude value
    `double` | `getCenterLon()` Deprecated. getter method for center longitude value
    `double` | `getRadiusMeters()` Deprecated. getter method for distance value (in meters)
    `int` | `hashCode()` Deprecated.
    `Query` | `rewrite(IndexReader reader)` Deprecated.
    `String` | `toString(String field)` Deprecated.

    - ### Methods inherited from class org.apache.lucene.spatial.geopoint.search.GeoPointInBBoxQuery

      `getField, getMaxLat, getMaxLon, getMinLat, getMinLon`

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

      `classHash, createWeight, sameClassAs, toString`

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

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

- - ### Field Detail

    - #### centerLat

          protected final double centerLat

      Deprecated.
      latitude value (in degrees) for query location

    - #### centerLon

          protected final double centerLon

      Deprecated.
      longitude value (in degrees) for query location

    - #### radiusMeters

          protected final double radiusMeters

      Deprecated.
      distance (in meters) from lat, lon center location

    - #### sortKey

          protected final double sortKey

      Deprecated.
      partial haversin computation

  - ### Constructor Detail

    - #### GeoPointDistanceQuery

          public GeoPointDistanceQuery(String field,
                                       double centerLat,
                                       double centerLon,
                                       double radiusMeters)

      Deprecated.
      Constructs a Query for all `GeoPointField` types within a distance (in meters) from a given point

    - #### GeoPointDistanceQuery

          public GeoPointDistanceQuery(String field,
                                       GeoPointField.TermEncoding termEncoding,
                                       double centerLat,
                                       double centerLon,
                                       double radiusMeters)

      Deprecated.
      Constructs a Query for all `GeoPointField` types within a distance (in meters) from a given point. Accepts optional `GeoPointField.TermEncoding` parameter

  - ### Method Detail

    - #### rewrite

          public Query rewrite(IndexReader reader)

      Deprecated.
      Overrides:
        `rewrite` in class `GeoPointInBBoxQuery`

    - #### equals

          public boolean equals(Object o)

      Deprecated.
      Overrides:
        `equals` in class `GeoPointInBBoxQuery`

    - #### hashCode

          public int hashCode()

      Deprecated.
      Overrides:
        `hashCode` in class `GeoPointInBBoxQuery`

    - #### toString

          public String toString(String field)

      Deprecated.
      Overrides:
        `toString` in class `GeoPointInBBoxQuery`

    - #### getCenterLon

          public double getCenterLon()

      Deprecated.
      getter method for center longitude value

    - #### getCenterLat

          public double getCenterLat()

      Deprecated.
      getter method for center latitude value

    - #### getRadiusMeters

          public double getRadiusMeters()

      Deprecated.
      getter method for distance value (in meters)

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