]> git.openstreetmap.org Git - nominatim.git/blob - lib-sql/tokenizer/icu_tokenizer_tables.sql
icu tokenizer: switch to matching against partial names
[nominatim.git] / lib-sql / tokenizer / icu_tokenizer_tables.sql
1 DROP TABLE IF EXISTS word;
2 CREATE TABLE word (
3   word_id INTEGER,
4   word_token text NOT NULL,
5   type text NOT NULL,
6   word text,
7   info jsonb
8 ) {{db.tablespace.search_data}};
9
10 CREATE INDEX idx_word_word_token ON word
11     USING BTREE (word_token) {{db.tablespace.search_index}};
12 -- Used when updating country names from the boundary relation.
13 CREATE INDEX idx_word_country_names ON word
14     USING btree(word) {{db.tablespace.address_index}}
15     WHERE type = 'C';
16 -- Used when inserting new postcodes on updates.
17 CREATE INDEX idx_word_postcodes ON word
18     USING btree(word) {{db.tablespace.address_index}}
19     WHERE type = 'P';
20 -- Used when inserting full words.
21 CREATE INDEX idx_word_full_word ON word
22     USING btree(word) {{db.tablespace.address_index}}
23     WHERE type = 'W';
24
25 GRANT SELECT ON word TO "{{config.DATABASE_WEBUSER}}";
26
27 DROP SEQUENCE IF EXISTS seq_word;
28 CREATE SEQUENCE seq_word start 1;
29 GRANT SELECT ON seq_word to "{{config.DATABASE_WEBUSER}}";