Re: Compound words giving undesirable results with tsearch2

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Lars Haugseth <njus(at)larshaugseth(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Compound words giving undesirable results with tsearch2
Date: 2006-05-30 14:11:08
Message-ID: Pine.GSO.4.63.0605301810370.24663@ra.sai.msu.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 30 May 2006, Lars Haugseth wrote:

> I've setup a database using tsearch2, configured with support for compound
> words according to the excellent guide found here:
>
> http://www.sai.msu.su/~megera/oddmuse/index.cgi/Tsearch_V2_compound_words
>
> This works fine. There is however one drawback that I'd like to know
> whether can be remedied. Let's say I want to search for records containing
> the word 'fritekst', which is a compound Norwegian word meaning
> 'free text'.
>
> testdb=# select to_tsquery('default_norwegian', 'fritekst');
> to_tsquery
> ------------------------------
> 'fritekst' | 'fri' & 'tekst'
> (1 row)
>
> Now, this will indeed match those records, but it will also match any
> records containing both of the words 'fri' and 'tekst', without regard
> to whether they are next to each other or in completely different parts
> of the text being indexed. In many situations, this will lead to a lot
> of 'false' matches, seen from a user perspective.
>
> Ideas on how to handle this problem will be much appreciated.

this is where order by relevance should helps.

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Teodor Sigaev 2006-05-30 14:50:10 Re: Compound words giving undesirable results with tsearch2
Previous Message Tatsuo Ishii 2006-05-30 13:48:38 Re: Charset conversion error