Skip to content
Snippets Groups Projects
Commit 5e01e8ac authored by Jorge Santos's avatar Jorge Santos
Browse files

Modify Pelias lookup to return multiple results

- Fixes #1353
  - Do not limit the results returned from Pelias to 1;
  - Removed test that was enforcing this condition;
parent 6435f4e6
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