]> git.openstreetmap.org Git - nominatim.git/blob - sql/words.sql
clean up docs for lookup call
[nominatim.git] / sql / words.sql
1 CREATE TABLE word_frequencies AS
2   (SELECT unnest(make_keywords(v)) as id, sum(count) as count
3      FROM (select svals(name) as v, count(*)from place group by v) cnt
4     WHERE v is not null
5  GROUP BY id);
6
7 select count(getorcreate_postcode_id(v)) from (select distinct address->'postcode' as v from place where address ? 'postcode') as w where v is not null;
8 select count(getorcreate_housenumber_id(make_standard_name(v))) from (select distinct address->'housenumber' as v from place where address ? 'housenumber') as w;
9
10 -- copy the word frequencies
11 update word set search_name_count = count from word_frequencies wf where wf.id = word.word_id;
12
13 -- and drop the temporary frequency table again
14 drop table word_frequencies;