Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.sai.msu.su/~megera/postgres/fts/doc/sql-fts-createdict.html
Дата изменения: Unknown Дата индексирования: Sun Apr 13 07:53:20 2008 Кодировка: Поисковые слова: m 8 |
Full-Text Search in PostgreSQL: A Gentle Introduction | ||||
---|---|---|---|---|
Prev | Fast Backward | Fast Forward | Next |
CREATE FULLTEXT DICTIONARY dictname LEXIZE lexize_function [INIT init_function ] [OPTION opt_text ] ;
CREATE FULLTEXT DICTIONARY dictname
[ { INIT init_function
| LEXIZE lexize_function
| OPTION opt_text }
[ ... ]] LIKE template_dictname;
CREATE FULLTEXT DICTIONARY will create a new dictionary used to transform input word to a lexeme.
If a schema name is given (for example, CREATE FULLTEXT DICTIONARY myschema.dictname ...) then the dictionary is created in the specified schema. Otherwise it is created in the current schema.
The name (optionally schema-qualified) of the new dictionary.
lexize_function is the name of the function, which does transformation of input word.
init_function is the name of the function, which initialize dictionary.
opt_text is the meaning of the opt_text varies among dictionaries. Usually, it stores various options required for the dictionary, for example, location of stop words file. Relative paths are defined with regard to PGROOT/share/dicts_data directory.
template_dictname is the name (optionally schema-qualified) of existing full-text dictionary used as a template. Values of INIT, LEXIZE, OPTION parameters, if defined, will substitute default values of the template dictionary.
Create dictionary public.my_simple in public schema, which uses functions defined for system pg_catalog.simple dictionary. We specify location of stop-word file.
=# CREATE FULLTEXT DICTIONARY public.my_simple LEXIZE dsimple_lexize INIT dsimple_init OPTION '/usr/local/share/dicts/english.stop'; =# select lexize('public.my_simple','YeS'); lexize -------- {yes} =# select lexize('public.my_simple','The'); lexize -------- {}
This could be done easier using template.
=# CREATE FULLTEXT DICTIONARY public.my_simple OPTION '/usr/local/share/dicts/english.stop' LIKE pg_catalog.simple; =# select lexize('public.my_simple','YeS'); lexize -------- {yes} =# select lexize('public.my_simple','The'); lexize -------- {}