Package org.hibernate.search.spatial

Examples of org.hibernate.search.spatial.DistanceSortField


    org.apache.lucene.search.Query luceneQuery = builder.spatial().onCoordinates( "location" )
        .within( 100, Unit.KM ).ofLatitude( centerLatitude ).andLongitude( centerLongitude ).createQuery();

    FullTextQuery hibQuery = fullTextSession.createFullTextQuery( luceneQuery, POI.class );
    Sort distanceSort = new Sort( new DistanceSortField( centerLatitude, centerLongitude, "location" ) );
    hibQuery.setSort( distanceSort );
    hibQuery.setProjection( FullTextQuery.THIS, FullTextQuery.SPATIAL_DISTANCE );
    hibQuery.setSpatialParameters( centerLatitude, centerLongitude, "location" );
    List<Object[]> results = hibQuery.list();
View Full Code Here


        .buildQueryBuilder().forEntity( NonGeoPOI.class ).get();

    org.apache.lucene.search.Query luceneQuery = builder.all().createQuery();

    FullTextQuery hibQuery = fullTextSession.createFullTextQuery( luceneQuery, NonGeoPOI.class );
    Sort distanceSort = new Sort( new DistanceSortField( centerLatitude, centerLongitude, "location" ) );
    hibQuery.setSort( distanceSort );
    hibQuery.setProjection( FullTextQuery.THIS, FullTextQuery.SPATIAL_DISTANCE );
    hibQuery.setSpatialParameters( centerLatitude, centerLongitude, "location" );

    // TODO - unclear what this should to. See HSEARCH-1708. ATM the calculated distance is the same for all points.
View Full Code Here

    org.apache.lucene.search.Query luceneQuery = builder.spatial().onCoordinates( "location" )
        .within( 100, Unit.KM ).ofLatitude( centerLatitude ).andLongitude( centerLongitude ).createQuery();

    FullTextQuery hibQuery = em.createFullTextQuery( luceneQuery, POI.class );
    Sort distanceSort = new Sort( new DistanceSortField( centerLatitude, centerLongitude, "location" ) );
    hibQuery.setSort( distanceSort );
    hibQuery.setProjection( FullTextQuery.THIS, FullTextQuery.SPATIAL_DISTANCE );
    hibQuery.setSpatialParameters( centerLatitude, centerLongitude, "location" );
    List results = hibQuery.getResultList();
    Object[] firstResult = (Object[]) results.get( 0 );
View Full Code Here

          .ofLatitude( centerLatitude )
          .andLongitude( centerLongitude )
        .createQuery();

    FullTextQuery hibQuery = em.createFullTextQuery( luceneQuery, POI.class );
    Sort distanceSort = new Sort( new DistanceSortField( centerLatitude, centerLongitude, "location" ) );
    hibQuery.setSort( distanceSort );
    hibQuery.setMaxResults( 1000 );
    hibQuery.setProjection( FullTextQuery.THIS, FullTextQuery.SPATIAL_DISTANCE );
    hibQuery.setSpatialParameters( centerLatitude, centerLongitude, "location" );
    List<Object[]> results = hibQuery.getResultList();
View Full Code Here

    org.apache.lucene.search.Query luceneQuery = builder.spatial().onCoordinates( "location" ).within( 100, Unit.KM ).ofLatitude( centerLatitude )
        .andLongitude( centerLongitude ).createQuery();

    FullTextQuery hibQuery = em.createFullTextQuery( luceneQuery, POI.class );
    Sort distanceSort = new Sort( new DistanceSortField( centerLatitude, centerLongitude, "location" ) );
    hibQuery.setSort( distanceSort );
    hibQuery.setProjection( FullTextQuery.THIS, FullTextQuery.SPATIAL_DISTANCE );
    // Set max results to 3 when 6 documents are stored:
    hibQuery.setMaxResults( 3 );
    hibQuery.setSpatialParameters( centerLatitude, centerLongitude, "location" );
View Full Code Here

    hibQuery.setProjection( FullTextQuery.THIS, FullTextQuery.SPATIAL_DISTANCE );
    hibQuery.setSpatialParameters( startLat, startLon, Spatial.COORDINATES_DEFAULT_FIELD );

    if ( sortByDistance ) {
      Sort distanceSort = new Sort(
          new DistanceSortField(
              startLat,
              startLon,
              Spatial.COORDINATES_DEFAULT_FIELD
          )
      );
View Full Code Here

TOP

Related Classes of org.hibernate.search.spatial.DistanceSortField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.