duwanis/asari — pull request #15 by kaiuhl (2013-09-12 18:53:43+00:00)
Title: Geographic queries

This PR adds basic coordinate storage helper methods to Asari.

Cloudsearch doesn't support float storage—only unsigned integers. To be able to store coordinates, we need to convert latitudes and longitudes to a cartographic projection. In this case, latitudes and longitudes are stored from 0 to 360,000.

The boolean search addition from PR #14 already create the query interface—simply use ranges as the values.

@asari.search filter: { and: Asari::GeographyConversion.coordinate_box(meters: 5000, lat: 45.52, lng: 122.682) }