From: Sarah Hoffmann Date: Thu, 14 Dec 2017 23:10:05 +0000 (+0100) Subject: fix address walk-up for reverse X-Git-Tag: v3.1.0~19 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/ed85388de5215a5fc9a982e7bd2286ba8ba3fef5?hp=-c fix address walk-up for reverse Fixes the row for the join and completely drops parts that have a linked_place_id. Fixes #859. --- ed85388de5215a5fc9a982e7bd2286ba8ba3fef5 diff --git a/lib/ReverseGeocode.php b/lib/ReverseGeocode.php index e538620a..27f8c89c 100644 --- a/lib/ReverseGeocode.php +++ b/lib/ReverseGeocode.php @@ -206,9 +206,10 @@ class ReverseGeocode } else { $iPlaceID = $oResult->iId; } - $sSQL = 'select coalesce(p.linked_place_id, a.address_place_id)'; + $sSQL = 'select a.address_place_id'; $sSQL .= ' FROM place_addressline a, placex p'; - $sSQL .= " WHERE a.place_id = $iPlaceID and a.place_id = p.place_id"; + $sSQL .= " WHERE a.place_id = $iPlaceID and a.address_place_id = p.place_id"; + $sSQL .= ' AND p.linked_place_id is null'; $sSQL .= " ORDER BY abs(cached_rank_address - $iMaxRank) asc,cached_rank_address desc,isaddress desc,distance desc"; $sSQL .= ' LIMIT 1'; $iPlaceID = chksql($this->oDB->getOne($sSQL), 'Could not get parent for place.');