Results 1 to 3 of 3

Thread: Returned metric from GeoNear query with spring data mongodb

  1. #1
    Join Date
    Dec 2011
    Posts
    10

    Default Returned metric from GeoNear query with spring data mongodb

    I asked the same question on stackoverflow without much luck.

    In my repository I have this method:

    Code:
    GeoPage<MyType> findByLocNear(Point location, Distance distance, Pageable pageable);
    If I pass to it a Distance with Metrics.Kilometers, the GeoResults in the GeoPage have the distance with Metric.Neutral. Is this the correct behavior or am I missing something? I can get the correct value moltiplying the distance value by 6378.137, but still, I'm confused on how this should work.

    Test:

    Code:
    GeoPage<MyObject> results = myObjectRepository.findByLocNear(new Point(9.1916, 45.464), new Distance(500, Metrics.KILOMETERS),new PageRequest(0, 10));
    assertEquals("KILOMETERS", results.getContent().get(0).getDistance().getMetric());
    result:

    Code:
    java.lang.AssertionError: expected:<KILOMETERS> but was:<NEUTRAL>

  2. #2
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    492

    Default

    I've filed and fixed [0]. Should be available in the latest snapshots.

    [0] https://jira.springsource.org/browse/DATAMONGO-603

  3. #3
    Join Date
    Dec 2011
    Posts
    10

    Default

    Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •