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('[email protected]')
     to_tsvector
----------------------
 '[email protected]':1

I expects TRUE for all next tsqueryes:

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

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

=# select to_tsvector('[email protected]') @@ to_tsquery('us:*');
 ?column?
----------
 t
(1 row)

=# select to_tsvector('[email protected]') @@ to_tsquery('user:*');
 ?column?
----------
 t

=# select to_tsvector('[email protected]') @@ to_tsquery('user@:*');
 ?column?
----------
 t

select to_tsvector('[email protected]') @@ to_tsquery('user@comp:*');
 ?column?
----------
 f   <---- FALSE (I expects TRUE)

=# select to_tsvector('[email protected]') @@ to_tsquery('user@company:*');
 ?column?
----------
 f   <---- FALSE (I expects TRUE)

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

=# select to_tsvector('[email protected]') @@ to_tsquery('[email protected]:*');
 ?column?
----------
 f  <---- FALSE  (I expects TRUE)

=# select to_tsvector('[email protected]') @@ to_tsquery('[email protected]:
*');
 ?column?
----------
 t  <---- TRUE .... OOhhhhhHHH I'm going crazy!!!

=# select to_tsvector('[email protected]') @@ to_tsquery('[email protected]:
*');
 ?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!

Reply via email to