Re: A couple of tsearch loose ends - Mailing list pgsql-hackers

From Tom Lane
Subject Re: A couple of tsearch loose ends
Date
Msg-id 6376.1187723893@sss.pgh.pa.us
Whole thread Raw
In response to Re: A couple of tsearch loose ends  (Teodor Sigaev <teodor@sigaev.ru>)
Responses Re: A couple of tsearch loose ends  (Oleg Bartunov <oleg@sai.msu.su>)
Re: A couple of tsearch loose ends  (Dimitri Fontaine <dfontaine@hi-media.com>)
List pgsql-hackers
Teodor Sigaev <teodor@sigaev.ru> writes:
> I havn't any objections. "with map" was introduced when another options 
>   was existed - locale and default flag.

OK, I'll make that happen.

>> The other thing that was bugging me was that a lot of the dictionary
>> types have init options that are named things like DictFile, AffFile,
>> etc.

> DictFile and AffFile are files of ispell ( or derived from it ) 
> dictionaries, we don't manage that files - they require a lot of 
> lingustic knowledge which we don't have and I don't hope that there is 
> such man in pgsql community. So, we just use they.

Hmm ... I suppose, but I'd still prefer that the option names didn't
include the word "file".

Also, while revising the reference pages for the syntax changes I made,
I realized that there's further simplification possible for the
dictionary commands.  I changed these commands to use the same
"definition list" construct that's used by CREATE OPERATOR and such.
It has the nice property that the option "keywords" aren't actually
keywords in the eyes of the grammar, they're just any identifiers.
So what we have got as of CVS HEAD is

CREATE TEXT SEARCH DICTIONARY name (   TEMPLATE = template   [, OPTION = init_options ]
)

ALTER TEXT SEARCH DICTIONARY name (   OPTION = init_options
)

where "init_options" is supposed to be a string literal containing stuff
like'Language=swedish, StopWords=swedish'

When you look at it, this is downright silly.  Why don't we flatten
the two levels together and write something like

CREATE TEXT SEARCH DICTIONARY swedish (   TEMPLATE = snowball,   LANGUAGE = swedish,   STOPWORDS = swedish
);

The original implementation couldn't do that but it's easy in the
definition-list grammar.  This is even more useful for ALTER, because
it'd be possible to change the value of one option without having to
write out the values of all the others.  What I'd suggest is that
we adopt the convention that an option is dropped if its name appears
with no value, otherwise it's kept unless overridden with a new value.
So after

ALTER TEXT SEARCH DICTIONARY swedish (   STOPWORDS
);

this dictionary would have LANGUAGE = swedish and no stopwords option.

Any objections to changing it like that?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Chernow
Date:
Subject: PGparam extension version 0.4
Next
From: Andrew Chernow
Date:
Subject: PGparam extension version 0.4