Re: A couple of tsearch loose ends

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: A couple of tsearch loose ends
Date: 2007-08-21 19:18:13
Message-ID: 6376.1187723893@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Teodor Sigaev <teodor(at)sigaev(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Chernow 2007-08-21 19:44:11 PGparam extension version 0.4
Previous Message Heikki Linnakangas 2007-08-21 18:46:01 Crash with empty dictionary