Announcement Announcement Module
Collapse
No announcement yet.
Returned metric from GeoNear query with spring data mongodb Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    I've filed and fixed [0]. Should be available in the latest snapshots.

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

    Comment


    • #3
      Thank you!

      Comment

      Working...
      X