Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.sai.msu.su/~megera/postgres/fts/doc/fts-cfg.html
Дата изменения: Unknown Дата индексирования: Sun Apr 13 07:44:12 2008 Кодировка: Поисковые слова: п п п п п п п п п п п п п п п п п п п п п п п п |
Full-Text Search in PostgreSQL: A Gentle Introduction | ||||
---|---|---|---|---|
Prev | Fast Backward | Chapter 2. FTS Operators and Functions | Fast Forward | Next |
A FTS configuration specifies all of the equipment necessary to transform a
document into a tsvector: the parser that breaks its text into
tokens, and the dictionaries, which then transform each
token into a lexeme. Every call to to_tsvector()
,
to_tsquery()
uses a configuration to perform its
processing.
Default FTS configurations contain in 4 tables in
pg_catalog schema, namely,
pg_ts_cfg,
pg_ts_parser,
pg_ts_dict,
pg_ts_cfgmap.
To facilitate management of FTS objects a set of SQL commands, described in FTS Reference Part I, is available. This is a recommended way.
Predefined system FTS objects are available in pg_catalog schema. If you need a custom configuration you can create a new FTS object and modify it using SQL commands, described in FTS Reference Part I. For example, to customize parser, create full-text configuration and change the value of the PARSER parameter.
=# CREATE FULLTEXT CONFIGURATION public.testcfg LIKE russian_utf8 WITH MAP; =# ALTER FULLTEXT CONFIGURATION public.testcfg SET PARSER htmlparser;
New FTS objects created in the current schema on default, usually, in public schema, but schema-qualified name could be used to create object in the specified schema. It owned by the current user and can be changed using ALTER FULLTEXT ... OWNER SQL command. Visibility of FTS objects conforms to the standard PostgreSQL rule and defined by search_path variable, see example in ALTER FULLTEXT ... OWNER. By default, the first visible schema is the pg_catalog, so that system FTS objects always mask users. To change that, explicitly specify pg_catalog in the search_path variable.
GUC variable tsearch_conf_name (optionally schema-qualified) defines the name of the current active configuration. It can be defined in postgresql.conf or using SQL command.
Notice, that pg_catalog schema, if not explicitly specified in the search_path, implicitly placed as the first schema to browse.
=# alter fulltext configuration public.russian_utf8 SET AS DEFAULT; ALTER FULLTEXT CONFIGURATION =# \dF *.russ*utf8 List of fulltext configurations Schema | Name | Locale | Default | Description ------------+--------------+-------------+---------+----------------------------------------- pg_catalog | russian_utf8 | ru_RU.UTF-8 | Y | default configuration for Russian/UTF-8 public | russian_utf8 | ru_RU.UTF-8 | Y | (2 rows) =# show tsearch_conf_name; tsearch_conf_name ------------------------- pg_catalog.russian_utf8 (1 row) =# set search_path=public, pg_catalog; SET =# show tsearch_conf_name; tsearch_conf_name --------------------- public.russian_utf8
There are several psql commands, which display various information about FTS objects (Section 2.11).