ALTER TEXT SEARCH CONFIGURATION modifies the definition of a text search configuration. You can modify its mappings from token types to dictionaries, change the configuration's name or owner, or modify the parameters.
1 2 | ALTER TEXT SEARCH CONFIGURATION name ADD MAPPING FOR token_type [, ... ] WITH dictionary_name [, ... ]; |
1 2 | ALTER TEXT SEARCH CONFIGURATION name ALTER MAPPING FOR token_type [, ... ] REPLACE old_dictionary WITH new_dictionary; |
1 2 | ALTER TEXT SEARCH CONFIGURATION name ALTER MAPPING FOR token_type [, ... ] WITH dictionary_name [, ... ]; |
1 2 | ALTER TEXT SEARCH CONFIGURATION name ALTER MAPPING REPLACE old_dictionary WITH new_dictionary; |
1 2 | ALTER TEXT SEARCH CONFIGURATION name DROP MAPPING [ IF EXISTS ] FOR token_type [, ... ]; |
1 | ALTER TEXT SEARCH CONFIGURATION name OWNER TO new_owner; |
1 | ALTER TEXT SEARCH CONFIGURATION name RENAME TO new_name; |
1 | ALTER TEXT SEARCH CONFIGURATION name SET SCHEMA new_schema; |
1 | ALTER TEXT SEARCH CONFIGURATION name SET ( { configuration_option = value } [, ...] ); |
1 | ALTER TEXT SEARCH CONFIGURATION name RESET ( {configuration_option} [, ...] ); |
Specifies the name (optionally schema-qualified) of an existing text search configuration.
Specifies the name of a token type that is emitted by the configuration's parser. For details, see Text Search Parser.
Specifies the name of a text search dictionary to be consulted for the specified token types. If multiple dictionaries are listed, they are consulted in the specified order.
Specifies the name of a text search dictionary to be replaced in the mapping.
Specifies the name of a text search dictionary to be substituted for old_dictionary.
Specifies the new owner of the text search configuration.
Specifies the new name of the text search configuration.
Specifies the new schema for the text search configuration.
Text search configuration option. For details, see CREATE TEXT SEARCH CONFIGURATION.
Specifies the value of text search configuration option.
Create a text search configuration:
1 2 | DROP TEXT SEARCH CONFIGURATION IF EXISTS ngram1; CREATE TEXT SEARCH CONFIGURATION ngram1 (parser=ngram) WITH (gram_size = 2, grapsymbol_ignore = false); |
Add a type mapping for the text search type ngram1.
1 | ALTER TEXT SEARCH CONFIGURATION ngram1 ADD MAPPING FOR multisymbol WITH simple; |
Change the owner of text search configuration.
1 2 | CREATE ROLE joe password '{Password}'; ALTER TEXT SEARCH CONFIGURATION ngram1 OWNER TO joe; |
Change the schema of text search configuration.
1 | ALTER TEXT SEARCH CONFIGURATION ngram1 SET SCHEMA joe; |
Rename a text search configuration.
1 | ALTER TEXT SEARCH CONFIGURATION joe.ngram1 RENAME TO ngram_1; |
Delete type mapping.
1 | ALTER TEXT SEARCH CONFIGURATION joe.ngram_1 DROP MAPPING IF EXISTS FOR multisymbol; |
Create a text search configuration:
1 2 | DROP TEXT SEARCH CONFIGURATION IF EXISTS english_1; CREATE TEXT SEARCH CONFIGURATION english_1 (parser=default); |
Add text search configuration string mapping.
1 | ALTER TEXT SEARCH CONFIGURATION english_1 ADD MAPPING FOR word WITH simple,english_stem; |
Add text search configuration string mapping.
1 | ALTER TEXT SEARCH CONFIGURATION english_1 ADD MAPPING FOR email WITH english_stem, french_stem; |
Modify text search configuration string mapping.
1 | ALTER TEXT SEARCH CONFIGURATION english_1 ALTER MAPPING REPLACE french_stem with german_stem; |
Query information about the text search configuration.
1 2 3 4 5 6 7 8 | SELECT b.cfgname,a.maptokentype,a.mapseqno,a.mapdict,c.dictname FROM pg_ts_config_map a,pg_ts_config b, pg_ts_dict c WHERE a.mapcfg=b.oid AND a.mapdict=c.oid AND b.cfgname='english_1' ORDER BY 1,2,3,4,5; cfgname | maptokentype | mapseqno | mapdict | dictname -----------+--------------+----------+---------+-------------- english_1 | 2 | 1 | 3765 | simple english_1 | 2 | 2 | 12960 | english_stem english_1 | 4 | 1 | 12960 | english_stem english_1 | 4 | 2 | 12966 | german_stem (4 rows) |