Re: Multiple word synonyms (maybe?) - Mailing list pgsql-general

From Kevin Grittner
Subject Re: Multiple word synonyms (maybe?)
Date
Msg-id 805875888.293307.1445434838875.JavaMail.yahoo@mail.yahoo.com
Whole thread Raw
In response to Re: Multiple word synonyms (maybe?)  (Tim van der Linden <tim@shisaa.jp>)
Responses Re: Multiple word synonyms (maybe?)  (Tim van der Linden <tim@shisaa.jp>)
List pgsql-general
On Tuesday, October 20, 2015 7:56 PM, Tim van der Linden <tim@shisaa.jp> wrote:
> On Tue, 20 Oct 2015 12:02:46 +0100

>> ​Does the Thesaurus dictionary not do what you want?​
>> ​
>> http://www.postgresql.org/docs/current/static/textsearch-dictionaries.html#TEXTSEARCH-THESAURUS
>
> Damn, I completely overlooked that one, and it indeed does seem
> to come very close to what I need in this use case.

I have to admit that the name of that dictionary type threw me off
a bit at first.

> If I am not mistaken, this would be a valid thesaurus file:
>
> acute mi : heart attack
> mi : heart attack
> myocardial infarction : heart attack​
>
> Multiple words on both ends, separated by a colon and each line
> being functional (a unique phrase linked to its more generic
> replacement)?

It has been a while, but my recollection is that I did something
more like this:

heart attack : heartattack
acute mi : heartattack
mi : heartattack
myocardial infarction : heartattack​

If my memory is to be trusted, both the original words (whichever
are actually in the document) and the "invented" synonym
("heartattack") will be in the tsvector/tsquery; this results in
all *matching* but the identical wording being considered a *closer
match*.

As with most things, I encourage you to play around with it a bit
to see what gives the best results for you.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: BDR - DDL Locking
Next
From: Dane Foster
Date:
Subject: Re: My first PL/pgSQL function