Searching email, Full Text Search prefix, not expected results - Mailing list pgsql-general

From Daniel Vázquez
Subject Searching email, Full Text Search prefix, not expected results
Date
Msg-id CA+KJVfy35315A_XnfxGdrDcyzQuDF5Rqp0gegCMgjA9SaxcEeA@mail.gmail.com
Whole thread Raw
Responses Re: Searching email, Full Text Search prefix, not expected results  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Searching email, Full Text Search prefix, not expected results  (Daniel Vázquez <daniel2d2art@gmail.com>)
List 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@company.com')
     to_tsvector      
----------------------

I expects TRUE for all next tsqueryes:

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

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

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

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

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

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

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

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

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

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

=# select to_tsvector('user@company.com') @@ to_tsquery('user@company.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!

pgsql-general by date:

Previous
From: François Beausoleil
Date:
Subject: Re: COPY and indices?
Next
From: John R Pierce
Date:
Subject: Re: Upgrade questions