X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/73953cbac95847740339d7a5ee3c0e5f142d93c5..452021ef0c9ac746949a2ef7fd12db4c2d5fee35:/lib-sql/functions/address_lookup.sql diff --git a/lib-sql/functions/address_lookup.sql b/lib-sql/functions/address_lookup.sql index b6c552c4..3ea72cb1 100644 --- a/lib-sql/functions/address_lookup.sql +++ b/lib-sql/functions/address_lookup.sql @@ -223,11 +223,13 @@ BEGIN OR placex.country_code = place.country_code) ORDER BY rank_address desc, (place_addressline.place_id = in_place_id) desc, - (fromarea and place.centroid is not null and not isaddress - and (place.address is null or avals(name) && avals(place.address)) - and ST_Contains(geometry, place.centroid)) desc, - isaddress desc, fromarea desc, - distance asc, rank_search desc + (CASE WHEN coalesce((avals(name) && avals(place.address)), False) THEN 2 + WHEN isaddress THEN 0 + WHEN fromarea + and place.centroid is not null + and ST_Contains(geometry, place.centroid) THEN 1 + ELSE -1 END) desc, + fromarea desc, distance asc, rank_search desc LOOP -- RAISE WARNING '%',location; location_isaddress := location.rank_address != current_rank_address;