Skip to content

Instantly share code, notes, and snippets.

@grauwoelfchen
Last active December 15, 2015 02:09
Show Gist options
  • Save grauwoelfchen/5185261 to your computer and use it in GitHub Desktop.
Save grauwoelfchen/5185261 to your computer and use it in GitHub Desktop.
# load extension
CREATE EXTENSION tsearch2;
# add permission
GRANT ALL ON pg_ts_config to USER_NAME;
GRANT ALL ON pg_ts_config_map to USER_NAME;
GRANT ALL ON pg_ts_dict to USER_NAME;
GRANT ALL ON pg_ts_parser to USER_NAME;
# create configuration
CREATE TEXT SEARCH CONFIGURATION public.default_german ( COPY = pg_catalog.german );
# create ispell dictionary
CREATE TEXT SEARCH DICTIONARY german_ispell (
TEMPLATE = ispell,
DictFile = german_fulltext,
AffFile = german_fulltext,
StopWords = german_fulltext
);
# setup tokens with ispell and stem dictionaries.
ALTER TEXT SEARCH CONFIGURATION default_german
ALTER MAPPING FOR
asciiword, asciihword, hword_asciipart,
word, hword, hword_part, hword_numpart,
numword, numhword
WITH german_ispell, german_stem;
# setup some tokens with simple dictionary.
ALTER TEXT SEARCH CONFIGURATION default_german
ALTER MAPPING FOR
host, file, int, uint, version
WITH simple;
# drop some tokens from default setting
ALTER TEXT SEARCH CONFIGURATION default_german
DROP MAPPING FOR
email, url, url_path, sfloat, float;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment