]> git.openstreetmap.org Git - nominatim.git/commitdiff
reduce search area for secondary adresses when areas are involved
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 6 Feb 2015 22:22:20 +0000 (23:22 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 9 Feb 2015 18:35:15 +0000 (19:35 +0100)
sql/functions.sql

index c46b3cf628470d58e9d07a9327551515436dd95c..9aaab2566fd01ff5c97f5e1f7c3a68dd0c08960b 100644 (file)
@@ -1794,7 +1794,20 @@ BEGIN
 
       IF location.rank_address != location_rank_search THEN
         location_rank_search := location.rank_address;
-        location_distance := location.distance * 1.5;
+        IF location.isguess THEN
+          location_distance := location.distance * 1.5;
+        ELSE
+          IF location.rank_address <= 12 THEN
+            -- for county and above, if we have an area consider that exact
+            -- (It would be nice to relax the constraint for places close to
+            --  the boundary but we'd need the exact geometry for that. Too
+            --  expensive.)
+            location_distance = 0;
+          ELSE
+            -- Below county level remain slightly fuzzy.
+            location_distance := location.distance * 0.5;
+          END IF;
+        END IF;
       ELSE
         CONTINUE WHEN location.keywords <@ location_keywords;
       END IF;