Re: Compound words giving undesirable results with tsearch2 - Mailing list pgsql-general

From Teodor Sigaev
Subject Re: Compound words giving undesirable results with tsearch2
Date
Msg-id 447C5BA2.7080503@sigaev.ru
Whole thread Raw
In response to Compound words giving undesirable results with tsearch2  (Lars Haugseth <njus@larshaugseth.com>)
List pgsql-general
> 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.

It's a special feature (piece from mail from our norwegian customer)

<quotation>
Let us take the compound 'fotballbane'. (Soccer field)
Split : 'fotball' 'fot' 'ball' 'bane'

Example record : "Vedlikehold av baner for fotballklubber"
(Literal translation : "Maintenance of fields for soccer clubs")

The search for 'fotballbane' ('fotballbane' & 'fotball' & 'fot' &
'ball') will not match, even though the record is precisely about this
sort of thing. 'fotballbane' | ('fotball' & 'bane') | ('fot' & 'ball' &
'bane') will match.
</quotation>

So, all variants to split compound words are joined with OR, words in one
variant are joined with AND.

If thats isn't desirable you can forbid word split for ispell (just comment z
flag) or use for searching different configuration of tsearch.


--
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
                                                    WWW: http://www.sigaev.ru/

pgsql-general by date:

Previous
From: "Daniel Verite"
Date:
Subject: Re: UTF-8 context of BYTEA datatype??
Next
From: Jim Nasby
Date:
Subject: Re: DB structure for logically similar objects in different