chewy icon indicating copy to clipboard operation
chewy copied to clipboard

Chewy DSL - how to do a geo-type filter?

Open hiyer opened this issue 10 years ago • 2 comments

How do I filter for objects within, say, 'x' km of a specific longitude-latitude pair? In JSON I would use something like geo_distance: { distance: "#{x}km", coordinates: { lat: "#latitude", lon: "#longitude" } } but how do I express this in the Chewy DSL?

hiyer avatar Feb 15 '16 09:02 hiyer

Never mind - I figured it out. I can do something like this: filter(geo_distance: {distance: "25km", coordinates: {lat: <latitude>, lon:<longitude>}})

hiyer avatar Feb 15 '16 11:02 hiyer

Perfect :+1:

pyromaniac avatar Feb 15 '16 11:02 pyromaniac