Skip to content

Instantly share code, notes, and snippets.

@Turupawn
Created July 16, 2020 22:48
Show Gist options
  • Save Turupawn/96cac22337d165b885e3b19a028c2de1 to your computer and use it in GitHub Desktop.
Save Turupawn/96cac22337d165b885e3b19a028c2de1 to your computer and use it in GitHub Desktop.
pgsearch custom dictionary & configuration
# 1. Create config
CREATE TEXT SEARCH CONFIGURATION public.my_config ( COPY = pg_catalog.spanish );
# 2. Create dictionary
CREATE TEXT SEARCH DICTIONARY public.my_dict ( TEMPLATE = pg_catalog.simple, STOPWORDS = russian);
# 3. Alter config
ALTER TEXT SEARCH CONFIGURATION public.my_config ALTER MAPPING FOR asciiword, asciihword, hword_asciipart, hword, hword_part, word WITH my_dict;
# 4. ????
CREATE INDEX body_idx ON comments USING gin (to_tsvector('german_nostop', body));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment