X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/70f154be8b69d3b57eebd25eff225ee29ccc97ba..56d24085f9b5b2e1d0d0fd5ff8af0c905765ff04:/lib-sql/tokenizer/legacy_icu_tokenizer.sql?ds=sidebyside

diff --git a/lib-sql/tokenizer/legacy_icu_tokenizer.sql b/lib-sql/tokenizer/legacy_icu_tokenizer.sql
index f4258f82..ffe6648c 100644
--- a/lib-sql/tokenizer/legacy_icu_tokenizer.sql
+++ b/lib-sql/tokenizer/legacy_icu_tokenizer.sql
@@ -98,13 +98,13 @@ DECLARE
   term_count INTEGER;
 BEGIN
   SELECT min(word_id) INTO full_token
-    FROM word WHERE info->>'word' = norm_term and type = 'W';
+    FROM word WHERE word = norm_term and type = 'W';
 
   IF full_token IS NULL THEN
     full_token := nextval('seq_word');
-    INSERT INTO word (word_id, word_token, info)
-      SELECT full_token, lookup_term,
-             json_build_object('word', norm_term, 'count', 0)
+    INSERT INTO word (word_id, word_token, type, word, info)
+      SELECT full_token, lookup_term, 'W', norm_term,
+             json_build_object('count', 0)
         FROM unnest(lookup_terms) as lookup_term;
   END IF;
 
@@ -123,8 +123,8 @@ BEGIN
     IF term_id IS NULL THEN
       term_id := nextval('seq_word');
       term_count := 0;
-      INSERT INTO word (word_id, word_token, info)
-        VALUES (term_id, term, json_build_object('count', term_count));
+      INSERT INTO word (word_id, word_token, type, info)
+        VALUES (term_id, term, 'w', json_build_object('count', term_count));
     END IF;
 
     IF term_count < {{ max_word_freq }} THEN
