Full Text Search in Postgres

Posted by yhuang
Public (Editable by Users)
SQL
None
Edit
# Create text search configuration.
create text search configuration devbits_config (copy=simple); # Uses simple as a template.

# Alter mapping in text search configuration.
alter text search configuration my_config alter mapping for asciiword with my_dictionary;
alter text search configuration my_config alter mapping for asciiword with my_dictionary, simple; # falls back to simple

# Remove mapping in text search configuration.
alter text search configuration my_config drop mapping if exists for url;

# Delete text search configurtion.
drop text search configuration my_config;

# Create text search dictionary.
create text search dictionary my_dictionary (
	template = thesaurus,
	dictfile = my_thesaurus_file,  # Must be located in postgres shared dir.
	dictionary = simple            # Dictionary for thesaurus
);

# Drop text search dictionary.
drop text search dictionary my_dictionary;