Fall back to alternative tsearch dictionary directory - Mailing list pgsql-bugs

From Martin Pitt
Subject Fall back to alternative tsearch dictionary directory
Date
Msg-id 20081201152226.GB8620@piware.de
Whole thread Raw
Responses Re: Fall back to alternative tsearch dictionary directory  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Hello all,

as recently mentioned on pg-general@, I am currently working on making
installed myspell/unspell dictionary packages (which install
themselves in /usr/share/myspell/dicts, mostly LATIN encoded)
available to PostgreSQL's tsearch/word stemming in Debian/Ubuntu.

So far I wrote the postgresql-common infrastructure to mangle these
dictionary/affix files to become palatable for PostgreSQL (recoding to
UTF-8, renaming to lowercase, changing file suffix) and install them
into /var/cache/postgresql/dicts/ whenever a {hun,my}spell-* package
is installed or updated.

The remaining bit is teaching postgresql to actually look into
/var/cache/postgresql/dicts/ if it does not find a matching
dictionary/affix file in ${sharepath}/tsearch_data/.

The reasons why I'm not using ${sharepath}/tsearch_data/ in the first
place are that

 - it's autogenerated data, as opposed to files statically shipped in
   a package

 - I do not want to conflict to/overwrite files which the admin
   manually put there.

I created an initial demo patch which provides this fallback. It works
great, it passes my test cases (which set up tsearch full text search
and stemming handling) and is pretty simple, too.

However, the path is hardcoded so far, which is of course bad for
upstream inclusion. So this should either become a ./configure option
--with-tsearch-dict-fallback=path (or similar), or even a new optional
configuration parameter for postgresql.conf.

However, before I work on that, I'd like to collect some opinions
about the general idea, and whether you prefer autoconf option or
postgresql.conf, or whether you wouldn't accept it at all?

Thanks a lot in advance!

Martin

--
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)

Attachment

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: BUG #4554: download crashes
Next
From: Tom Lane
Date:
Subject: Re: Fall back to alternative tsearch dictionary directory