X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/1618aba5f282a27fc45af28c4eeebb6dcd28c332..5d32ac9ac918929c11602a740c3033bcfdb0f929:/lib-sql/tokenizer/icu_tokenizer_tables.sql?ds=sidebyside

diff --git a/lib-sql/tokenizer/icu_tokenizer_tables.sql b/lib-sql/tokenizer/icu_tokenizer_tables.sql
index 1d70a9c3..7ec3c6f8 100644
--- a/lib-sql/tokenizer/icu_tokenizer_tables.sql
+++ b/lib-sql/tokenizer/icu_tokenizer_tables.sql
@@ -1,8 +1,9 @@
 DROP TABLE IF EXISTS word;
-CREATE TABLE word_icu (
+CREATE TABLE word (
   word_id INTEGER,
   word_token text NOT NULL,
   type text NOT NULL,
+  word text,
   info jsonb
 ) {{db.tablespace.search_data}};
 
@@ -10,7 +11,17 @@ CREATE INDEX idx_word_word_token ON word
     USING BTREE (word_token) {{db.tablespace.search_index}};
 -- Used when updating country names from the boundary relation.
 CREATE INDEX idx_word_country_names ON word
-    USING btree((info->>'cc')) WHERE type = 'C';
+    USING btree(word) {{db.tablespace.address_index}}
+    WHERE type = 'C';
+-- Used when inserting new postcodes on updates.
+CREATE INDEX idx_word_postcodes ON word
+    USING btree(word) {{db.tablespace.address_index}}
+    WHERE type = 'P';
+-- Used when inserting full words.
+CREATE INDEX idx_word_full_word ON word
+    USING btree(word) {{db.tablespace.address_index}}
+    WHERE type = 'W';
+
 GRANT SELECT ON word TO "{{config.DATABASE_WEBUSER}}";
 
 DROP SEQUENCE IF EXISTS seq_word;
