2 * Copyright (C) 2004-2008 Georgia Public Library Service
3 * Copyright (C) 2008 Equinox Software, Inc., Laurentian University
4 * Mike Rylander <miker@esilibrary.com>
5 * Dan Scott <dscott@laurentian.ca>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
21 SET search_path = public, pg_catalog;
23 CREATE OR REPLACE FUNCTION oils_tsearch2 () RETURNS TRIGGER AS $$
25 NEW.index_vector = to_tsvector((TG_ARGV[0])::regconfig, NEW.value);
34 FOR lang IN SELECT substring(pptsd.dictname from '(.*)_stem$') AS lang FROM pg_catalog.pg_ts_dict pptsd JOIN pg_catalog.pg_namespace ppn ON ppn.oid = pptsd.dictnamespace
35 WHERE ppn.nspname = 'pg_catalog' AND pptsd.dictname LIKE '%_stem' LOOP
36 RAISE NOTICE 'FOUND LANGUAGE %', lang;
38 EXECUTE 'DROP TEXT SEARCH DICTIONARY IF EXISTS ' || lang || '_nostop CASCADE;
39 CREATE TEXT SEARCH DICTIONARY ' || lang || '_nostop (TEMPLATE=pg_catalog.snowball, language=''' || lang || ''');
40 COMMENT ON TEXT SEARCH DICTIONARY ' || lang || '_nostop IS ''' ||lang || ' snowball stemmer with no stopwords for ASCII words only.'';
41 CREATE TEXT SEARCH CONFIGURATION ' || lang || '_nostop ( COPY = pg_catalog.' || lang || ' );
42 ALTER TEXT SEARCH CONFIGURATION ' || lang || '_nostop ALTER MAPPING FOR word, hword, hword_part WITH pg_catalog.simple;
43 ALTER TEXT SEARCH CONFIGURATION ' || lang || '_nostop ALTER MAPPING FOR asciiword, asciihword, hword_asciipart WITH ' || lang || '_nostop;';
48 --CREATE TEXT SEARCH CONFIGURATION title ( COPY = english_nostop );
49 --CREATE TEXT SEARCH CONFIGURATION author ( COPY = english_nostop );
50 --CREATE TEXT SEARCH CONFIGURATION subject ( COPY = english_nostop );
51 CREATE TEXT SEARCH CONFIGURATION keyword ( COPY = english_nostop );
52 --CREATE TEXT SEARCH CONFIGURATION identifier ( COPY = english_nostop );
53 --CREATE TEXT SEARCH CONFIGURATION series ( COPY = english_nostop );
54 CREATE TEXT SEARCH CONFIGURATION "default" ( COPY = english_nostop );