From: Sarah Hoffmann Date: Sat, 4 Aug 2018 21:19:32 +0000 (+0200) Subject: Merge pull request #1110 from lonvia/remove-address-check-for-long-lines X-Git-Tag: v3.2.0~34 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/9bdbbec0c8141bdcb22fb562b4e1235dadcc446c?hp=-c Merge pull request #1110 from lonvia/remove-address-check-for-long-lines Remove special search for address part for long ways --- 9bdbbec0c8141bdcb22fb562b4e1235dadcc446c diff --combined sql/functions.sql index 7c62bc93,993084ef..ae6c73df --- a/sql/functions.sql +++ b/sql/functions.sql @@@ -35,7 -35,7 +35,7 @@@ CREATE OR REPLACE FUNCTION make_standar DECLARE o TEXT; BEGIN - o := gettokenstring(transliteration(name)); + o := public.gettokenstring(public.transliteration(name)); RETURN trim(substr(o,1,length(o))); END; $$ @@@ -256,28 -256,6 +256,28 @@@ END $$ LANGUAGE plpgsql IMMUTABLE; +CREATE OR REPLACE FUNCTION reverse_place_diameter(rank_search SMALLINT) + RETURNS FLOAT + AS $$ +BEGIN + IF rank_search <= 4 THEN + RETURN 5.0; + ELSIF rank_search <= 8 THEN + RETURN 1.8; + ELSIF rank_search <= 12 THEN + RETURN 0.6; + ELSIF rank_search <= 17 THEN + RETURN 0.16; + ELSIF rank_search <= 18 THEN + RETURN 0.08; + ELSIF rank_search <= 19 THEN + RETURN 0.04; + END IF; + + RETURN 0.02; +END; +$$ +LANGUAGE plpgsql IMMUTABLE; CREATE OR REPLACE FUNCTION get_postcode_rank(country_code VARCHAR(2), postcode TEXT, OUT rank_search SMALLINT, OUT rank_address SMALLINT) @@@ -1897,33 -1875,6 +1897,6 @@@ BEGI END LOOP; --DEBUG: RAISE WARNING 'address computed'; - -- for long ways we should add search terms for the entire length - IF st_length(NEW.geometry) > 0.05 THEN - - 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_address != location_rank_search THEN - location_rank_search := location.rank_address; - location_distance := location.distance * 1.5; - END IF; - - IF location.rank_search > 4 AND location.distance < location_distance THEN - - -- Add it to the list of search terms - nameaddress_vector := array_merge(nameaddress_vector, location.keywords::integer[]); - INSERT INTO place_addressline (place_id, address_place_id, fromarea, isaddress, distance, cached_rank_address) - VALUES (NEW.place_id, location.place_id, true, false, location.distance, location.rank_address); - - END IF; - - END LOOP; - - END IF; - --DEBUG: RAISE WARNING 'search terms for long ways added'; - IF NEW.address is not null AND NEW.address ? 'postcode' AND NEW.address->'postcode' not similar to '%(,|;)%' THEN NEW.postcode := upper(trim(NEW.address->'postcode'));