|
Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.sai.msu.su/~megera/postgres/fts/doc/sql-fts-createcfg.html
Дата изменения: Unknown Дата индексирования: Sun Apr 13 07:52:33 2008 Кодировка: Поисковые слова: asteroid |
| Full-Text Search in PostgreSQL: A Gentle Introduction | ||||
|---|---|---|---|---|
| Prev | Fast Backward | Fast Forward | Next | |
CREATE FULLTEXT CONFIGURATION cfgname PARSER prsname [ LOCALE localename] [AS DEFAULT];
CREATE FULLTEXT CONFIGURATION cfgname [{ PARSER prsname | LOCALE localename } [ ...]] LIKE template_cfg [WITH MAP] [AS DEFAULT];
CREATE FULLTEXT CONFIGURATION will create a new FTS configuration. The new configuration will be owned by the user issuing the command.
If a schema name is given (for example, CREATE FULLTEXT CONFIGURATION myschema.cfgname ...) then the configuration is created in the specified schema. Otherwise it is created in the current schema.
The name (optionally schema-qualified) of the full-text configuration to be created.
psrname is the name (optionally schema-qualified) of the parser.
localename is the name of the locale. It should match server's locale (lc_ctype) to identify full-text configuration used by default.
Existing full-text configuration template_cfg (optionally schema-qualified) will be used to create new configuration. Values of PARSER, LOCALE parameters, if defined, will substitute default values of the template configuration.
If specified, then full-text mapping of template configuration is copied to the new configuration.
Set default flag for the configuration, which used to identify if this configuration is selectable on default (see LOCALE description above). It is possible to have maximum one configuration with the same locale and in the same schema with this flag enabled.
Create new configuration test with default parser and ru_RU.UTF-8 locale.
=# CREATE FULLTEXT CONFIGURATION test PARSER default LOCALE 'ru_RU.UTF-8'; =# \dF+ test Configuration "public.test" Parser name: "pg_catalog.default" Locale: 'ru_RU.UTF-8' Token | Dictionaries -------+--------------
Now we create configuration using english configuration (parser and full-text mapping) but with ru_RU.UTF-8 locale.
=# CREATE FULLTEXT CONFIGURATION test LOCALE 'ru_RU.UTF-8' LIKE english WITH MAP;
CREATE FULLTEXT CONFIGURATION
=# \dF+ test
Configuration "public.test"
Parser name: "pg_catalog.default"
Locale: 'ru_RU.UTF-8'
Token | Dictionaries
--------------+--------------------
email | pg_catalog.simple
file | pg_catalog.simple
float | pg_catalog.simple
host | pg_catalog.simple
hword | pg_catalog.simple
int | pg_catalog.simple
lhword | pg_catalog.en_stem
lpart_hword | pg_catalog.en_stem
lword | pg_catalog.en_stem
nlhword | pg_catalog.simple
nlpart_hword | pg_catalog.simple
nlword | pg_catalog.simple
part_hword | pg_catalog.simple
sfloat | pg_catalog.simple
uint | pg_catalog.simple
uri | pg_catalog.simple
url | pg_catalog.simple
version | pg_catalog.simple
word | pg_catalog.simpleIn the example below we first create test configuration (in public schema by default) with default flag enabled using system configuration pg_catalog.russian_utf8 as template. Then, we create another configuration with the same parameters as earlier and show that default flag was removed from test configuration.
=# CREATE FULLTEXT CONFIGURATION test LIKE pg_catalog.russian_utf8 AS DEFAULT;
CREATE FULLTEXT CONFIGURATION
=# \dF public.test
List of fulltext configurations
Schema | Name | Locale | Default | Description
--------+------+-------------+---------+-------------
public | test | ru_RU.UTF-8 | Y |
=# CREATE FULLTEXT CONFIGURATION test2 LIKE pg_catalog.russian_utf8 AS DEFAULT;
NOTICE: drop default flag for fulltext configuration "public.test"
=# \dF public.test*
List of fulltext configurations
Schema | Name | Locale | Default | Description
--------+-------+-------------+---------+-------------
public | test | ru_RU.UTF-8 | |
public | test2 | ru_RU.UTF-8 | Y |
=# ALTER FULLTEXT CONFIGURATION test2 DROP DEFAULT;
ALTER FULLTEXT CONFIGURATION
=# \dF public.test*
List of fulltext configurations
Schema | Name | Locale | Default | Description
--------+-------+-------------+---------+-------------
public | test | ru_RU.UTF-8 | |
public | test2 | ru_RU.UTF-8 | |