/** * Returns a Lucene Query searching directly by computing distance against * all docs in the index (costly !) * * @param center center of the search discus * @param radius distance max to center in km * @param fieldName name of the Lucene Field implementing Coordinates * @return Lucene Query to be used in a search * * @see Query * @see org.hibernate.search.spatial.Coordinates */ public static Query buildDistanceQuery(Coordinates center, double radius, String fieldName) { return buildDistanceQuery( null, center, radius, fieldName ); }
/** * Returns a Lucene Query searching directly by computing distance against * all docs in the index (costly !) * * @param center center of the search discus * @param radius distance max to center in km * @param fieldName name of the Lucene Field implementing Coordinates * @return Lucene Query to be used in a search * * @see Query * @see org.hibernate.search.spatial.Coordinates */ public static Query buildDistanceQuery(Coordinates center, double radius, String fieldName) { return buildDistanceQuery( null, center, radius, 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) {@link DistanceQuery}. * * @param center center of the search discus * @param radius distance max to center in km * @param fieldName name of the Lucene Field implementing Coordinates * @return Lucene Query to be used in a search * * @see Query * @see org.hibernate.search.spatial.Coordinates */ public static Query buildSpatialQueryByHash(Coordinates center, double radius, String fieldName) { return buildDistanceQuery( buildSpatialHashQuery( center, radius, fieldName ), center, radius, 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) {@link DistanceQuery}. * * @param center center of the search discus * @param radius distance max to center in km * @param fieldName name of the Lucene Field implementing Coordinates * @return Lucene Query to be used in a search * * @see Query * @see org.hibernate.search.spatial.Coordinates */ public static Query buildSpatialQueryByHash(Coordinates center, double radius, String fieldName) { return buildDistanceQuery( buildSpatialHashQuery( center, radius, fieldName ), center, radius, fieldName ); }
SpatialQueryBuilderFromCoordinates.buildDistanceQuery( query, center, luceneQuery = SpatialQueryBuilderFromCoordinates.buildDistanceQuery( center, radius, "location" ); hibQuery = fullTextSession.createFullTextQuery( luceneQuery, POI.class ); hibQuery.setProjection( "id", "name" );
.build(); return buildDistanceQuery( boxQuery, center,
.build(); return buildDistanceQuery( boxQuery, center,