Re: How to create dictionaries for tsearch

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Paulo Jan <admin(at)mail(dot)ddnet(dot)es>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to create dictionaries for tsearch
Date: 2002-10-03 19:09:43
Message-ID: Pine.GSO.4.44.0210032300050.423-100000@ra.sai.msu.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 3 Oct 2002, Paulo Jan wrote:

>
> Can I use OpenFTS to index and search databases que are not "pure
> text", but only have some text fields? From what I see, I have the
> impression that OpenFTS is designed to store and search text documents
> (newspaper articles, papers, etc.) using a Postgres backend, while in my
> case, I'm storing information (photographs and data associated to them)
> that has some text fields that need to be indexed and other "normal"
> fields (numeric, etc.) that don't need to be, and I need to search by
> both of them; in other words, I need to do something like "SELECT * FROM
> photos WHERE captionidx @@ 'angelina' AND resolution='high' AND
> photodate > '01-01-2002'". Can I use OpenFTS for this kind of mixed
> searches? From what I have read, I have the impression that it's a bit
> cumbersome to do so.

OpenFTS is an *engine* and was specially designed to be embedded
into application. It has several methods which could be used to
construct queries like you need ! For example, get_sql
from perldoc Search::OpenFTS
get_sql( \(at)ARRAY_WORD );
get_sql( $STRING );
get_sql( \$STRING );
get_sql( *, %opt );
%opt - as in the constructor (see above), plus a key
dict_opt = > {}, transmitted to dictionaries

Returns parts of SQL:

($out, $condition, $order)

Here is how they can be combined in an SQL statement:

SELECT
$opt{txttid}$out
FROM
table
WHERE
$condition
$order;

As a bonus you'll get relevance ranking, dictionaries support and
more control.

> Alternatively, can you use the snowball stemmer only with tsearch,
> without installing OpenFTS?
>

Not for the moment. It's easy to implement but we're very busy.

>
>
> Paulo Jan.
> DDnet.
>

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2002-10-03 19:21:06 Re: cluster replication with intermezzo
Previous Message Bruce Momjian 2002-10-03 19:07:39 Re: Oracle beats up on Open Source Database(s) ... and