]> git.openstreetmap.org Git - nominatim.git/commitdiff
linking: better name matching for address-less places
authorSarah Hoffmann <lonvia@denofr.de>
Sat, 21 Mar 2020 20:57:04 +0000 (21:57 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Sat, 21 Mar 2020 20:57:04 +0000 (21:57 +0100)
Administrative boundaries that do not figure in the address
should still be able to take part in the name matching.
Use the rank_search for comparison in this case.

sql/functions/placex_triggers.sql

index d23d39d24de69addba9de207b1b99eea701f5cca..b868d26704d48b003aa8ff03787600e2934b7a60 100644 (file)
@@ -253,7 +253,8 @@ BEGIN
     FOR linked_placex IN
       SELECT placex.* from placex
       WHERE make_standard_name(name->'name') = bnd_name
     FOR linked_placex IN
       SELECT placex.* from placex
       WHERE make_standard_name(name->'name') = bnd_name
-        AND placex.rank_address = bnd.rank_address
+        AND ((bnd.rank_address > 0 and placex.rank_address = bnd.rank_address)
+             OR (bnd.rank_address = 0 and placex.rank_search = bnd.rank_search))
         AND placex.osm_type = 'N'
         AND placex.rank_search < 26 -- needed to select the right index
         AND _st_covers(bnd.geometry, placex.geometry)
         AND placex.osm_type = 'N'
         AND placex.rank_search < 26 -- needed to select the right index
         AND _st_covers(bnd.geometry, placex.geometry)