From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marcin.Kasperski@mekk.waw.pl
Cc: pgsql-bugs@postgresql.org
Cc: Oleg Bartunov <oleg@sai.msu.su>
Cc: Teodor Sigaev <teodor@sigaev.ru>
Subject: Re: BUG #6327: Prefix full-text-search fails for hosts with complicated names
Date: Mon, 05 Dec 2011 10:38:04 -0500
Message-ID: <27803.1323099484@sss.pgh.pa.us> (raw)
In-Reply-To: <E1RXXq6-0000vH-BA@wrigleys.postgresql.org>
References: <E1RXXq6-0000vH-BA@wrigleys.postgresql.org>
Marcin.Kasperski@mekk.waw.pl writes:
> Synopsis
> =========
> 'goog:*' matches google.com
> but
> 'e-goog:*' does not match e-google.com
The reason for this seems to be that the pattern is treated as a
hyphenated word:
regression=# select TO_TSQUERY('english', 'e-goog:*');
to_tsquery
-------------------------------
'e-goog':* & 'e':* & 'goog':*
(1 row)
but the hostname isn't:
regression=# select TO_TSVECTOR('english', 'See e-google.com');
to_tsvector
--------------------------
'e-google.com':2 'see':1
(1 row)
If you change the text so it's not recognized as a hostname, you get
lexemes that would match the query:
regression=# select TO_TSVECTOR('english', 'See e-google com');
to_tsvector
---------------------------------------------
'com':5 'e':3 'e-googl':2 'googl':4 'see':1
(1 row)
Possibly we could fix this by hacking the ts parser so that it would
also apply the hyphenated-word rules to a hostname containing a dash.
In general though, there are always going to be cases where prefix
match doesn't work because of dictionary transformations ...
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, Marcin.Kasperski@mekk.waw.pl, oleg@sai.msu.su, teodor@sigaev.ru
Subject: Re: BUG #6327: Prefix full-text-search fails for hosts with complicated names
In-Reply-To: <27803.1323099484@sss.pgh.pa.us>
References: <E1RXXq6-0000vH-BA@wrigleys.postgresql.org> <27803.1323099484@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox