projects/aports·blob master · refs

41 lines · 1.2 KiB

1----
2-- Configure Czech ispell dictionary for fulltext search.
3--
4-- If the dictionary and configuration already exists, it will do nothing.
5----
6
7\set cfgname 'czech'
8\set dictname 'czech_ispell'
9-- change to 'simple' if you don't have czech stemmer
10\set stemmer 'czech_stem'
11\set namespace 'pg_catalog'
12
13\out /dev/null
14\timing off
15
16
17SET search_path = :"namespace";
18
19-- Create TS dictionary if not exists
20
21SELECT EXISTS (SELECT 1 FROM pg_ts_dict WHERE dictnamespace = :'namespace'::regnamespace AND dictname = :'dictname') AS has_dict;
22\gset
23
24\if :has_dict
25 \echo text search dictionary :"dictname" already exists in namespace :"namespace"
26\else
27 \echo creating text search dictionary :"dictname" in namespace :"namespace"
28 CREATE TEXT SEARCH DICTIONARY :"dictname" (
29 template = ispell,
30 dictfile = czech,
31 afffile = czech,
32 stopwords = czech
33 );
34 COMMENT ON TEXT SEARCH DICTIONARY :"dictname" IS 'Ispell dictionary for czech language';
35\endif
36
37-- Update TS configuration
38
39\echo updating text search configuration :"cfgname" in namespace :"namespace"
40ALTER TEXT SEARCH CONFIGURATION :"cfgname"
41 ALTER MAPPING FOR asciiword, asciihword, hword, hword_asciipart, hword_part, word WITH :"dictname", :"stemmer";