org.hibernate.search.spatial.impl

## Class DistanceQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.hibernate.search.spatial.impl.DistanceQuery

- All Implemented Interfaces:
    Cloneable

      public final class DistanceQuery
      extends Query

  Lucene distance Query for documents which have been indexed with `SpatialFieldBridgeByRange` Use double lat,long field in the index from a Coordinates field declaration
  Author:
    Nicolas Helleringer
  See Also:
    `SpatialFieldBridgeByHash`, `SpatialFieldBridgeByRange`, `Coordinates`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DistanceQuery(Query approximationQuery, Coordinates centerCoordinates, double radius, String coordinatesField)` Construct a distance query to match document distant at most of radius from center Point
    `DistanceQuery(Query approximationQuery, Coordinates centerCoordinates, double radius, String latitudeField, String longitudeField)` Construct a distance query to match document distant at most of radius from center Point

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Weight` | `createWeight(IndexSearcher searcher, boolean needsScores)`
    `boolean` | `equals(Object obj)`
    `Query` | `getApproximationQuery()`
    `Point` | `getCenter()`
    `String` | `getCoordinatesField()`
    `double` | `getRadius()`
    `int` | `hashCode()`
    `Query` | `rewrite(IndexReader reader)`
    `String` | `toString(String field)`

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

      `clone, getBoost, setBoost, toString`

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

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

- - ### Constructor Detail

    - #### DistanceQuery

          public DistanceQuery(Query approximationQuery,
                               Coordinates centerCoordinates,
                               double radius,
                               String coordinatesField)

      Construct a distance query to match document distant at most of radius from center Point
      Parameters:
        `approximationQuery` - an approximation for this distance query (i.e. a query that produces no false-negatives, but may produce false-positives), or `null`. If non-null, only documents returned by the approximation query will be considered, which will enhance performance.
        `centerCoordinates` - center of the search perimeter
        `radius` - radius of the search perimeter
        `coordinatesField` - name of the field implementing Coordinates
      See Also:
        `Coordinates`

    - #### DistanceQuery

          public DistanceQuery(Query approximationQuery,
                               Coordinates centerCoordinates,
                               double radius,
                               String latitudeField,
                               String longitudeField)

      Construct a distance query to match document distant at most of radius from center Point
      Parameters:
        `approximationQuery` - an approximation for this distance query (i.e. a query that produces no false-negatives, but may produce false-positives), or `null`. If non-null, only documents returned by the approximation query will be considered, which will enhance performance.
        `centerCoordinates` - center of the search perimeter
        `radius` - radius of the search perimeter
        `latitudeField` - name of the field hosting latitude
        `longitudeField` - name of the field hosting longitude
      See Also:
        `Coordinates`

  - ### Method Detail

    - #### rewrite

          public Query rewrite(IndexReader reader)
                        throws IOException

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

    - #### createWeight

          public Weight createWeight(IndexSearcher searcher,
                                     boolean needsScores)
                              throws IOException

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

    - #### getCoordinatesField

          public String getCoordinatesField()

    - #### getRadius

          public double getRadius()

    - #### getCenter

          public Point getCenter()

    - #### getApproximationQuery

          public Query getApproximationQuery()

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Query`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Query`

    - #### toString

          public String toString(String field)

      Specified by:
        `toString` in class `Query`

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved