From 5d87136969dc13951ddddac346ffd0cd95dc1326 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Fri, 6 Feb 2015 23:22:20 +0100 Subject: [PATCH] reduce search area for secondary adresses when areas are involved --- sql/functions.sql | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sql/functions.sql b/sql/functions.sql index c46b3cf6..9aaab256 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -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; -- 2.39.5