X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/b7704833e4b011541928372a46ea692c3a496b5c..a6b829e4a0861cfce02522e4577b33829b78d83c:/lib-sql/tokenizer/icu_tokenizer.sql?ds=inline diff --git a/lib-sql/tokenizer/icu_tokenizer.sql b/lib-sql/tokenizer/icu_tokenizer.sql index f86a0a37..04fcedcb 100644 --- a/lib-sql/tokenizer/icu_tokenizer.sql +++ b/lib-sql/tokenizer/icu_tokenizer.sql @@ -41,10 +41,17 @@ AS $$ $$ LANGUAGE SQL IMMUTABLE STRICT; +CREATE OR REPLACE FUNCTION token_is_street_address(info JSONB) + RETURNS BOOLEAN +AS $$ + SELECT info->>'street' is not null or info->>'place' is null; +$$ LANGUAGE SQL IMMUTABLE; + + CREATE OR REPLACE FUNCTION token_has_addr_street(info JSONB) RETURNS BOOLEAN AS $$ - SELECT info->>'street' is not null; + SELECT info->>'street' is not null and info->>'street' != '{}'; $$ LANGUAGE SQL IMMUTABLE; @@ -97,13 +104,6 @@ AS $$ $$ LANGUAGE SQL IMMUTABLE STRICT; -CREATE OR REPLACE FUNCTION token_normalized_postcode(postcode TEXT) - RETURNS TEXT -AS $$ - SELECT CASE WHEN postcode SIMILAR TO '%(,|;)%' THEN NULL ELSE upper(trim(postcode))END; -$$ LANGUAGE SQL IMMUTABLE STRICT; - - CREATE OR REPLACE FUNCTION token_get_postcode(info JSONB) RETURNS TEXT AS $$