Searching email, Full Text Search prefix, not expected results

From: Daniel Vázquez <daniel2d2art(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Searching email, Full Text Search prefix, not expected results
Date: 2012-03-14 18:05:42
Message-ID: CA+KJVfy35315A_XnfxGdrDcyzQuDF5Rqp0gegCMgjA9SaxcEeA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi guys, I'm going to crazy about FTS with prefix agains email values on
tsvector. Follow how to reproduce:

For the next tsvector:

=# select to_tsvector('user(at)company(dot)com')
to_tsvector
----------------------
'user(at)company(dot)com':1

I expects TRUE for all next tsqueryes:

select to_tsvector('user(at)company(dot)com') @@ to_tsquery('u:*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('us:*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('use:*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user:*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user@:*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)c:*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)co:*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)com:*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)comp:*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)compa:*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)compan:*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)company:*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)company(dot):*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)company(dot)c:*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)company(dot)co:*');
select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)company(dot)com:*');

But NOT, there are some NOT expected and confusing me results:

=# select to_tsvector('user(at)company(dot)com') @@ to_tsquery('us:*');
?column?
----------
t
(1 row)

=# select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user:*');
?column?
----------
t

=# select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user@:*');
?column?
----------
t

select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)comp:*');
?column?
----------
f <---- FALSE (I expects TRUE)

=# select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)company:*');
?column?
----------
f <---- FALSE (I expects TRUE)

=# select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)company(dot):*');
?column?
----------
f <---- FALSE (I expects TRUE)

=# select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)company(dot)c:*');
?column?
----------
f <---- FALSE (I expects TRUE)

=# select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)company(dot)co:
*');
?column?
----------
t <---- TRUE .... OOhhhhhHHH I'm going crazy!!!

=# select to_tsvector('user(at)company(dot)com') @@ to_tsquery('user(at)company(dot)com:
*');
?column?
----------
t <---- TRUE ... Yes I'm crazy.

Please some ligths about it.
(I follow the official docs in
http://www.postgresql.org/docs/9.1/interactive/textsearch.html for my
knowledge)

Thx!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2012-03-14 19:04:56 Re: Upgrade questions
Previous Message François Beausoleil 2012-03-14 17:38:53 Re: COPY and indices?