2022-01-03 18:23:58 +03:00
|
|
|
-- SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
--
|
|
|
|
-- This file is part of Nominatim. (https://nominatim.org)
|
|
|
|
--
|
|
|
|
-- Copyright (C) 2022 by the Nominatim developer community.
|
|
|
|
-- For a full list of authors see the git log.
|
|
|
|
|
2021-07-20 11:27:06 +03:00
|
|
|
DROP TABLE IF EXISTS word;
|
2021-07-22 18:24:43 +03:00
|
|
|
CREATE TABLE word (
|
2021-07-20 11:27:06 +03:00
|
|
|
word_id INTEGER,
|
|
|
|
word_token text NOT NULL,
|
|
|
|
type text NOT NULL,
|
2021-07-25 16:08:11 +03:00
|
|
|
word text,
|
2021-07-20 11:27:06 +03:00
|
|
|
info jsonb
|
|
|
|
) {{db.tablespace.search_data}};
|
|
|
|
|
|
|
|
CREATE INDEX idx_word_word_token ON word
|
|
|
|
USING BTREE (word_token) {{db.tablespace.search_index}};
|
2021-07-20 12:21:13 +03:00
|
|
|
-- Used when updating country names from the boundary relation.
|
|
|
|
CREATE INDEX idx_word_country_names ON word
|
2021-07-25 16:08:11 +03:00
|
|
|
USING btree(word) {{db.tablespace.address_index}}
|
2021-07-20 13:11:12 +03:00
|
|
|
WHERE type = 'C';
|
|
|
|
-- Used when inserting new postcodes on updates.
|
|
|
|
CREATE INDEX idx_word_postcodes ON word
|
2021-07-25 16:08:11 +03:00
|
|
|
USING btree(word) {{db.tablespace.address_index}}
|
2021-07-21 11:41:38 +03:00
|
|
|
WHERE type = 'P';
|
|
|
|
-- Used when inserting full words.
|
|
|
|
CREATE INDEX idx_word_full_word ON word
|
2021-07-25 16:08:11 +03:00
|
|
|
USING btree(word) {{db.tablespace.address_index}}
|
2021-07-21 11:41:38 +03:00
|
|
|
WHERE type = 'W';
|
2022-02-16 13:15:43 +03:00
|
|
|
-- Used when inserting analyzed housenumbers (exclude old-style entries).
|
|
|
|
CREATE INDEX idx_word_housenumbers ON word
|
|
|
|
USING btree(word) {{db.tablespace.address_index}}
|
|
|
|
WHERE type = 'H' and word is not null;
|
2021-07-21 11:41:38 +03:00
|
|
|
|
2021-07-20 11:27:06 +03:00
|
|
|
GRANT SELECT ON word TO "{{config.DATABASE_WEBUSER}}";
|
|
|
|
|
|
|
|
DROP SEQUENCE IF EXISTS seq_word;
|
|
|
|
CREATE SEQUENCE seq_word start 1;
|
|
|
|
GRANT SELECT ON seq_word to "{{config.DATABASE_WEBUSER}}";
|