Example usage for org.springframework.data.geo GeoPage GeoPage

List of usage examples for org.springframework.data.geo GeoPage GeoPage

Introduction

In this page you can find the example usage for org.springframework.data.geo GeoPage GeoPage.

Prototype

public GeoPage(GeoResults<T> results, Pageable pageable, long total) 

Source Link

Document

Creates a new GeoPage from the given GeoResults , Pageable and total.

Usage

From source file:com.ninjas.movietime.repository.TheaterRepository.java

public GeoPage<Theater> listByGeoLocation(Point point, PageRequest pageRequest) {
    Preconditions.checkNotNull(point);// w  ww . ja va  2s.c om
    Preconditions.checkNotNull(pageRequest);

    final NearQuery nearQuery = NearQuery.near(point).spherical(true).maxDistance(1, Metrics.KILOMETERS)
            .with(pageRequest);

    //final int size = getMongoTemplate().geoNear(nearQuery, Theater.class).getContent().size();

    final GeoResults<Theater> geoResults = getMongoTemplate().geoNear(nearQuery, Theater.class);

    final GeoPage<Theater> geoPage = new GeoPage<>(geoResults, pageRequest, 0);

    return geoPage;
}