From c963243035ca5ed4e67dc5234a2761e2cd49c99d Mon Sep 17 00:00:00 2001 From: Alexander Tsirel Date: Tue, 5 Nov 2024 17:58:57 +1100 Subject: [PATCH 1/2] use language option from the configuration --- lib/geocoder/lookups/amazon_location_service.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/geocoder/lookups/amazon_location_service.rb b/lib/geocoder/lookups/amazon_location_service.rb index 7179430e2..101d0874b 100644 --- a/lib/geocoder/lookups/amazon_location_service.rb +++ b/lib/geocoder/lookups/amazon_location_service.rb @@ -10,6 +10,9 @@ def results(query) # Aws::ParamValidator raises ArgumentError on missing required keys params.merge!(index_name: configuration[:index_name]) + # Inherit language from configuration + params.merge!(language: configuration[:language]) + # Aws::ParamValidator raises ArgumentError on unexpected keys params.delete(:lookup) From 02bba5b22af837889ed21cb62162797be70d32b9 Mon Sep 17 00:00:00 2001 From: Alexander Tsirel Date: Wed, 6 Nov 2024 13:59:37 +1100 Subject: [PATCH 2/2] beautify --- lib/geocoder/lookups/amazon_location_service.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/geocoder/lookups/amazon_location_service.rb b/lib/geocoder/lookups/amazon_location_service.rb index 101d0874b..4b37e3182 100644 --- a/lib/geocoder/lookups/amazon_location_service.rb +++ b/lib/geocoder/lookups/amazon_location_service.rb @@ -10,18 +10,18 @@ def results(query) # Aws::ParamValidator raises ArgumentError on missing required keys params.merge!(index_name: configuration[:index_name]) + # Aws::ParamValidator raises ArgumentError on unexpected keys + params.delete(:lookup) + # Inherit language from configuration params.merge!(language: configuration[:language]) - # Aws::ParamValidator raises ArgumentError on unexpected keys - params.delete(:lookup) - resp = if query.reverse_geocode? client.search_place_index_for_position(params.merge(position: query.coordinates.reverse)) else client.search_place_index_for_text(params.merge(text: query.text)) end - + resp.results end