Re: Compound words giving undesirable results with tsearch2
От | Teodor Sigaev |
---|---|
Тема | Re: Compound words giving undesirable results with tsearch2 |
Дата | |
Msg-id | 447C5BA2.7080503@sigaev.ru обсуждение исходный текст |
Ответ на | Compound words giving undesirable results with tsearch2 (Lars Haugseth <njus@larshaugseth.com>) |
Список | 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 по дате отправления: