From: Sarah Hoffmann Date: Sat, 25 Apr 2020 22:14:55 +0000 (+0200) Subject: ensure that result object name is always first in display_name X-Git-Tag: v3.5.0~28^2~1 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/6cc6cf950c3c08103e6159a079c85b5a4f1c09fa?hp=-c ensure that result object name is always first in display_name The display name might be mixed up if the result object has a lower rank_address than its address members. --- 6cc6cf950c3c08103e6159a079c85b5a4f1c09fa diff --git a/sql/functions/address_lookup.sql b/sql/functions/address_lookup.sql index 9a4c630c..f8659c70 100644 --- a/sql/functions/address_lookup.sql +++ b/sql/functions/address_lookup.sql @@ -60,7 +60,9 @@ BEGIN prevresult := ''; FOR location IN - SELECT * FROM get_addressdata(for_place_id, housenumber) + SELECT name, + CASE WHEN place_id = for_place_id THEN 99 ELSE rank_address END as rank_address + FROM get_addressdata(for_place_id, housenumber) WHERE isaddress order by rank_address desc LOOP currresult := trim(get_name_by_language(location.name, languagepref));