Hi,all,I think I find a not appropriate documentation in the follow file:
https://github.com/postgres/postgres/blob/master/doc/src/sgml/textsearch.sgml
-----------------------------------------------------------------------
242 <para>
243 Full text searching in <productname>PostgreSQL</productname> is based on
244 the match operator <literal>@@</literal>, which returns
245 <literal>true</literal> if a <type>tsvector</type>
246 (document) matches a <type>tsquery</type> (query).
247 It doesn't matter which data type is written first:
248
249<programlisting>
250SELECT 'a fat cat sat on a mat and ate a fat rat'::tsvector @@ 'cat & rat'::tsquery;
251 ?column?
252----------
253 t
254
255SELECT 'fat & cow'::tsquery @@ 'a fat cat sat on a mat and ate a fat rat'::tsvector;
256 ?column?
257----------
258 f
259</programlisting>
260 </para>
--------------------------------------------------------------------------
From line 242 to line 247 ,we know that this para is to say that “It doesn't matter which data type is written first in operator @@”.
So, from line 250 to 260 ,two example sqls were showed to explain that.
But,we can see that two sql is quuite different,which is hard to show the opinion.
I think maybe a example with two “same sql” which has just different order of data type is more clear. just like below:
Sql A:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
SELECT 'a fat cat sat on a mat and ate a fat rat'::tsvector @@ 'cat & rat'::tsquery;
?column?
----------
t
Sql B:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
postgres=# SELECT 'cat & rat'::tsquery @@ 'a fat cat sat on a mat and ate a fat rat';
?column?
----------
t
(1 row)
With the above two sql ,we can clearly see that It doesn't matter which data type is written first in operator @@.
--
Best Regards
-----------------------------------------------------
Wu Fei
Development Department II
Software Division III
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
ADDR.: No.6 Wenzhu Road, Software Avenue,
Nanjing, 210012, China
TEL : +86+25-86630566-9356
COINS: 7998-9356
FAX: +86+25-83317685
MAIL:wufei.fnst@cn.fujitsu.com
http://www.fujitsu.com/cn/fnst/
---------------------------------------------------