tsearch in core patch, for review

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: tsearch in core patch, for review
Date: 2006-12-20 17:35:56
Message-ID: 4589747C.5030201@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Sabino Mullane 2006-12-20 18:06:29 Rare corruption of pg_class index
Previous Message Joshua D. Drake 2006-12-20 17:31:26 Re: VS: Companies Contributing to Open Source