mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-08 19:14:07 +00:00
merge postcodes from address objects
Take the postcode from the first address object that has one tagged and use that as display postcode.
This commit is contained in:
@@ -2481,7 +2481,7 @@ BEGIN
|
|||||||
CASE WHEN class = 'place' and type = 'postcode' THEN hstore('name', postcode) ELSE name END as name,
|
CASE WHEN class = 'place' and type = 'postcode' THEN hstore('name', postcode) ELSE name END as name,
|
||||||
class, type, admin_level, fromarea, isaddress,
|
class, type, admin_level, fromarea, isaddress,
|
||||||
CASE WHEN address_place_id = for_place_id AND rank_address = 0 THEN 100 WHEN rank_address = 11 THEN 5 ELSE rank_address END as rank_address,
|
CASE WHEN address_place_id = for_place_id AND rank_address = 0 THEN 100 WHEN rank_address = 11 THEN 5 ELSE rank_address END as rank_address,
|
||||||
distance,calculated_country_code
|
distance,calculated_country_code,postcode
|
||||||
from place_addressline join placex on (address_place_id = placex.place_id)
|
from place_addressline join placex on (address_place_id = placex.place_id)
|
||||||
where place_addressline.place_id = for_place_id
|
where place_addressline.place_id = for_place_id
|
||||||
and (cached_rank_address > 0 AND cached_rank_address < searchrankaddress)
|
and (cached_rank_address > 0 AND cached_rank_address < searchrankaddress)
|
||||||
@@ -2496,6 +2496,9 @@ BEGIN
|
|||||||
IF searchpostcode IS NOT NULL and location.type = 'postcode' THEN
|
IF searchpostcode IS NOT NULL and location.type = 'postcode' THEN
|
||||||
location.isaddress := FALSE;
|
location.isaddress := FALSE;
|
||||||
END IF;
|
END IF;
|
||||||
|
IF searchpostcode IS NULL and location.isaddress and location.type != 'postcode' and location.postcode IS NOT NULL THEN
|
||||||
|
searchpostcode := location.postcode;
|
||||||
|
END IF;
|
||||||
IF location.rank_address = 4 AND location.isaddress THEN
|
IF location.rank_address = 4 AND location.isaddress THEN
|
||||||
hadcountry := true;
|
hadcountry := true;
|
||||||
END IF;
|
END IF;
|
||||||
|
|||||||
Reference in New Issue
Block a user