]> git.openstreetmap.org Git - nominatim.git/blob - lib-sql/words_from_search_name.sql
make sure old data gets deleted on place type change
[nominatim.git] / lib-sql / words_from_search_name.sql
1 DROP TABLE IF EXISTS word_frequencies;
2 CREATE TABLE word_frequencies AS
3  SELECT unnest(name_vector) as id, count(*) FROM search_name GROUP BY id;
4
5 CREATE INDEX idx_word_frequencies ON word_frequencies(id);
6
7 UPDATE word SET search_name_count = count
8   FROM word_frequencies
9  WHERE word_token like ' %' and word_id = id;
10
11 DROP TABLE word_frequencies;