tsearch in core patch, for review
tsearch in core patch, for review
От:
Teodor Sigaev <teodor@sigaev.ru>
Дата:
We (Oleg and me) are glad to present tsearch2 in core of pgsql patch. In basic,
layout, functions, methods, types etc are the same as in current tsearch2 with a
lot of improvements:
- pg_ts_* tables now are in pg_catalog - parsers, dictionaries, configurations now have owner and namespace similar to other pgsql's objects like tables, operator classes etc - current tsearch configuration is managed with a help of GUC variable tsearch_conf_name. - choosing of tsearch cfg by locale may be done for each schema separately - managing of tsearch configuration with a help of SQL commands, not with insert/update/delete statements. This allows to drive dependencies, correct dumping and dropping. - psql support with a help of \dF* commands - add all available Snowball stemmers and corresponding configuration - correct memory freeing by any dictionary
Work is sponsored by EnterpriseDB's PostgreSQL Development Fund
patch: http://www.sigaev.ru/misc/tsearch_core-0.27.gz
Sorry, but documentation is under heavy development now and temporary placed at
http://mira.sai.msu.su/~megera/pgsql/ftsdoc/ (changes quickly :) )
So, below there is a short overview of syntax.
Comments, suggestions, objections, questions will be appreciated. We are
planning to complete the patch and suggest to commit in HEAD soon.
SQL syntax:
CREATE FULLTEXT PARSER prsname ( START = funcname, GETTOKEN = funcname, END = funcname, LEXTYPES = funcname [ , HEADLINE = funcname ]
);
CREATE FULLTEXT DICTIONARY dictname ( LEXIZE = funcname [ , INIT = funcname ] [ , OPT = text ]
);
CREATE FULLTEXT DICTIONARY dictname [( { INIT = funcname | LEXIZE = funcname | OPT = text } [, ... ]
)] LIKE template_dictname;
ALTER FULLTEXT DICTIONARY dictname SET OPT=text;
CREATE FULLTEXT CONFIGURATION cfgname ( PARSER = prsname [, LOCALE = localename]
) [AS DEFAULT];
CREATE FULLTEXT CONFIGURATION cfgname [( { LOCALE = localename | PARSER = prsname } [, ...]
)] LIKE template_cfg [WITH MAP] [AS DEFAULT];
ALTER FULLTEXT CONFIGURATION cfgname SET { LOCALE=localename | PARSER=prsname } [, ...]; ALTER FULLTEXT CONFIGURATION cfgname SET AS DEFAULT; ALTER FULLTEXT CONFIGURATION cfgname DROP DEFAULT;
CREATE FULLTEXT MAPPING ON cfgname FOR lexemetypename[, ...] WITH dictname1[, ...];
ALTER FULLTEXT MAPPING ON cfgname FOR lexemetypename[, ...] WITH dictname1[, ...];
DROP FULLTEXT MAPPING [IF EXISTS] ON cfgname FOR lexemetypename;
DROP FULLTEXT { DICTIONARY | PARSER | CONFIGURATION } [IF EXISTS] objname [
CASCADE | RESTRICT ];
ALTER FULLTEXT { DICTIONARY | PARSER | CONFIGURATION } objname RENAME TO newobjname;
ALTER FULLTEXT { DICTIONARY | PARSER | CONFIGURATION } objname OWNER TO newowner;
COMMENT ON FULLTEXT { DICTIONARY | PARSER | CONFIGURATION } objname IS text;
psql backslesh commands:
\dF [PATTERN] list fulltext configurations (add "+" for more detail)
\dFd [PATTERN] list fulltext dictionaries (add "+" for more detail)
\dFp [PATTERN] list fulltext parsers (add "+" for more detail)
--
Teodor Sigaev E-mail: teodor@sigaev.ru WWW: http://www.sigaev.ru/
Re: tsearch in core patch, for review
От:
Teodor Sigaev <teodor@sigaev.ru>
Дата:
> patch: http://www.sigaev.ru/misc/tsearch_core-0.27.gz http://www.sigaev.ru/misc/tsearch_core-0.28.gz new version, because of XML commit - old patch doesn't apply cleanly. -- Teodor Sigaev E-mail: teodor@sigaev.ru WWW: http://www.sigaev.ru/