From 21b0bac4e79db6913522ac98888c13823d359d32 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sat, 21 Jul 2012 00:41:18 +0200 Subject: [PATCH] adapt distance heuristics for nodes Include only those nodes that are closer than 1.5 times the distance of the closest feature of the same address rank. --- sql/functions.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sql/functions.sql b/sql/functions.sql index 0a53fd64..d242418c 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -1629,7 +1629,7 @@ BEGIN -- RAISE WARNING 'ISIN: %', isin_tokens; -- Process area matches - location_rank_search := 100; + location_rank_search := 0; location_distance := 0; location_parent := NULL; -- RAISE WARNING ' getNearFeatures(%,''%'',%,''%'')',NEW.partition, place_centroid, search_maxrank, isin_tokens; @@ -1637,9 +1637,9 @@ BEGIN --RAISE WARNING ' AREA: %',location; - IF location.rank_search < location_rank_search THEN - location_rank_search := location.rank_search; - location_distance := location.distance * 0.5; + IF location.rank_address != location_rank_search THEN + location_rank_search := location.rank_address; + location_distance := location.distance * 1.5; END IF; IF location.distance < location_distance OR NOT location.isguess THEN @@ -1698,14 +1698,14 @@ BEGIN -- for long ways we should add search terms for the entire length IF st_length(NEW.geometry) > 0.05 THEN - location_rank_search := 100; + location_rank_search := 0; location_distance := 0; FOR location IN SELECT * from getNearFeatures(NEW.partition, NEW.geometry, search_maxrank, isin_tokens) LOOP - IF location.rank_search < location_rank_search THEN - location_rank_search := location.rank_search; - location_distance := location.distance * 0.5; + IF location.rank_address != location_rank_search THEN + location_rank_search := location.rank_address; + location_distance := location.distance * 1.5; END IF; IF location.distance < location_distance THEN