org.hibernate.search.spatial.impl

## Class SpatialQueryBuilderFromCoordinates

- java.lang.Object
- - org.hibernate.search.spatial.impl.SpatialQueryBuilderFromCoordinates

-     public abstract class SpatialQueryBuilderFromCoordinates
      extends Object

  The SpatialQueryBuilder holds builder methods for Hash, Distance and Spatial (Hash+Distance) queries
  Author:
    Nicolas Helleringer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SpatialQueryBuilderFromCoordinates()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Query` | `buildDistanceQuery(Coordinates center, double radius, String fieldName)` Returns a Lucene Query searching directly by computing distance against all docs in the index (costly !)
    `static Query` | `buildDistanceQuery(Query approximationQuery, Coordinates center, double radius, String coordinatesField)` Returns a Lucene query to match documents by distance to a center.
    `static Query` | `buildDistanceQuery(Query approximationQuery, Coordinates center, double radius, String latitudeField, String longitudeField)` Returns a Lucene query to match documents by distance to a center.
    `static Query` | `buildSpatialHashQuery(Coordinates center, double radius, String fieldName)` Returns a Lucene query to match documents by distance to a center, relying only on spatial hashes.
    `static Query` | `buildSpatialQueryByHash(Coordinates center, double radius, String fieldName)` Returns a Lucene query to match documents by distance to a center, relying first on spatial hash to approximate the result, and then on a more precise (but more costly) `DistanceQuery`.
    `static Query` | `buildSpatialQueryByRange(Coordinates centerCoordinates, double radius, String fieldName)` Returns a Lucene Query which rely on double numeric range query on Latitude / Longitude

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SpatialQueryBuilderFromCoordinates

          public SpatialQueryBuilderFromCoordinates()

  - ### Method Detail

    - #### buildSpatialHashQuery

          public static Query buildSpatialHashQuery(Coordinates center,
                                                    double radius,
                                                    String fieldName)

      Returns a Lucene query to match documents by distance to a center, relying only on spatial hashes.
      Parameters:
        `center` - center of the search discus
        `radius` - distance max to center in km
        `fieldName` - name of the Lucene Field implementing Coordinates
      Returns:
        Lucene Query to be used in a search
      See Also:
        `Query`, `Coordinates`

    - #### buildDistanceQuery

          public static Query buildDistanceQuery(Query approximationQuery,
                                                 Coordinates center,
                                                 double radius,
                                                 String coordinatesField)

      Returns a Lucene query to match documents by distance to a center.
      Parameters:
        `center` - center of the search discus
        `radius` - distance max to center in km
        `coordinatesField` - name of the Lucene Field implementing Coordinates
        `approximationQuery` - an approximation of the distance query (i.e. a query returning all the results returned by the distance query, but also some false positives). WARNING: when passing `null`, every single document will be scanned (time/resource consuming!)
      Returns:
        Lucene Query to be used in a search
      See Also:
        `Query`, `Coordinates`

    - #### buildDistanceQuery

          public static Query buildDistanceQuery(Query approximationQuery,
                                                 Coordinates center,
                                                 double radius,
                                                 String latitudeField,
                                                 String longitudeField)

      Returns a Lucene query to match documents by distance to a center.
      Parameters:
        `center` - center of the search discus
        `radius` - distance max to center in km
        `latitudeField` - name of the Lucene Field hosting latitude
        `longitudeField` - name of the Lucene Field hosting longitude
        `approximationQuery` - an approximation of the distance query (i.e. a query returning all the results returned by the distance query, but also some false positives). WARNING: when passing `null`, every single document will be scanned (time/resource consuming!)
      Returns:
        Lucene Query to be used in a search
      See Also:
        `Query`, `Coordinates`

    - #### buildDistanceQuery

          public static Query buildDistanceQuery(Coordinates center,
                                                 double radius,
                                                 String fieldName)

      Returns a Lucene Query searching directly by computing distance against all docs in the index (costly !)
      Parameters:
        `center` - center of the search discus
        `radius` - distance max to center in km
        `fieldName` - name of the Lucene Field implementing Coordinates
      Returns:
        Lucene Query to be used in a search
      See Also:
        `Query`, `Coordinates`

    - #### buildSpatialQueryByHash

          public static Query buildSpatialQueryByHash(Coordinates center,
                                                      double radius,
                                                      String fieldName)

      Returns a Lucene query to match documents by distance to a center, relying first on spatial hash to approximate the result, and then on a more precise (but more costly) `DistanceQuery`.
      Parameters:
        `center` - center of the search discus
        `radius` - distance max to center in km
        `fieldName` - name of the Lucene Field implementing Coordinates
      Returns:
        Lucene Query to be used in a search
      See Also:
        `Query`, `Coordinates`

    - #### buildSpatialQueryByRange

          public static Query buildSpatialQueryByRange(Coordinates centerCoordinates,
                                                       double radius,
                                                       String fieldName)

      Returns a Lucene Query which rely on double numeric range query on Latitude / Longitude
      Parameters:
        `centerCoordinates` - center of the search discus
        `radius` - distance max to center in km
        `fieldName` - name of the Lucene Field implementing Coordinates
      Returns:
        Lucene Query to be used in a search
      See Also:
        `Query`, `Coordinates`

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