X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/1033f8bce7dcfdae6120962ba42312ab862a8f7e..6e4ee160ee8f872ea29ea503ce7c6f058aad39ed:/sql/functions/normalization.sql

diff --git a/sql/functions/normalization.sql b/sql/functions/normalization.sql
index f5ed32e5..66d0214a 100644
--- a/sql/functions/normalization.sql
+++ b/sql/functions/normalization.sql
@@ -201,58 +201,25 @@ END;
 $$
 LANGUAGE plpgsql;
 
-
-CREATE OR REPLACE FUNCTION get_word_id(lookup_word TEXT)
-  RETURNS INTEGER
-  AS $$
-DECLARE
-  lookup_token TEXT;
-  return_word_id INTEGER;
-BEGIN
-  lookup_token := trim(lookup_word);
-  SELECT min(word_id) FROM word
-    WHERE word_token = lookup_token and class is null and type is null
-    INTO return_word_id;
-  RETURN return_word_id;
-END;
-$$
-LANGUAGE plpgsql STABLE;
-
-
-CREATE OR REPLACE FUNCTION get_name_id(lookup_word TEXT)
-  RETURNS INTEGER
-  AS $$
-DECLARE
-  lookup_token TEXT;
-  return_word_id INTEGER;
-BEGIN
-  lookup_token := ' '||trim(lookup_word);
-  SELECT min(word_id) FROM word
-    WHERE word_token = lookup_token and class is null and type is null
-    INTO return_word_id;
-  RETURN return_word_id;
-END;
-$$
-LANGUAGE plpgsql STABLE;
-
-
-CREATE OR REPLACE FUNCTION get_name_ids(lookup_word TEXT)
+-- Normalize a string and lookup its word ids (partial words).
+CREATE OR REPLACE FUNCTION addr_ids_from_name(lookup_word TEXT)
   RETURNS INTEGER[]
   AS $$
 DECLARE
   lookup_token TEXT;
-  return_word_ids INTEGER[];
+  return_word_id INTEGER[];
 BEGIN
-  lookup_token := ' '||trim(lookup_word);
+  lookup_token := make_standard_name(lookup_word);
   SELECT array_agg(word_id) FROM word
     WHERE word_token = lookup_token and class is null and type is null
-    INTO return_word_ids;
-  RETURN return_word_ids;
+    INTO return_word_id;
+  RETURN return_word_id;
 END;
 $$
 LANGUAGE plpgsql STABLE;
 
 
+-- Normalize a string and look up its name ids (full words).
 CREATE OR REPLACE FUNCTION word_ids_from_name(lookup_word TEXT)
   RETURNS INTEGER[]
   AS $$
