Skip to content
Snippets Groups Projects
Unverified Commit 2e720f9b authored by Alex Reisner's avatar Alex Reisner Committed by GitHub
Browse files

Merge pull request #1356 from jsantos/bugfix/multiple_results_on_pelias

Modify Pelias lookup to return multiple results
parents 6435f4e6 5e01e8ac
No related branches found
No related tags found
No related merge requests found
......@@ -24,12 +24,11 @@ module Geocoder::Lookup
def query_url_params(query)
params = {
api_key: configuration.api_key,
size: 1
api_key: configuration.api_key
}.merge(super)
if query.reverse_geocode?
lat,lon = query.coordinates
lat, lon = query.coordinates
params[:'point.lat'] = lat
params[:'point.lon'] = lon
else
......
......@@ -17,14 +17,9 @@ class PeliasTest < GeocoderTestCase
assert_true query.url.start_with?('http://self.hosted.pelias/proxy/v1/search'), query.url
end
def test_query_url_defaults_to_one
query = Geocoder::Query.new('Madison Square Garden, New York, NY')
assert_match 'size=1', query.url
end
def test_query_for_reverse_geocode
lookup = Geocoder::Lookup::Pelias.new
url = lookup.query_url(Geocoder::Query.new([45.423733, -75.676333]))
assert_match(/point.lat=45.423733&point.lon=-75.676333&size=1/, url)
assert_match(/point.lat=45.423733&point.lon=-75.676333/, url)
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment