Text Search Operators
@@
Description: Specifies whether the tsvector-typed words match the tsquery-typed words.
Example:
1 2 3 4 5 |
gaussdb=# SELECT to_tsvector('fat cats ate rats') @@ to_tsquery('cat & rat') AS RESULT; result -------- t (1 row) |
@@@
Description: Synonym for @@
Example:
1 2 3 4 5 |
gaussdb=# SELECT to_tsvector('fat cats ate rats') @@@ to_tsquery('cat & rat') AS RESULT; result -------- t (1 row) |
||
- Description: Performs the OR operation on two tsquery-typed words.
1 2 3 4 5
gaussdb=# SELECT 'fat | rat'::tsquery || 'cat'::tsquery AS RESULT; result --------------------------- ( 'fat' | 'rat' ) | 'cat' (1 row)
&&
Description: Performs the AND operation on two tsquery-typed words.
Example:
1 2 3 4 5 |
gaussdb=# SELECT 'fat | rat'::tsquery && 'cat'::tsquery AS RESULT; result --------------------------- ( 'fat' | 'rat' ) & 'cat' (1 row) |
!!
Description: Not a tsquery-typed word.
Example:
1 2 3 4 5 |
gaussdb=# SELECT !! 'cat'::tsquery AS RESULT; result -------- !'cat' (1 row) |
@>
Description: Specifies whether a tsquery-typed word contains another tsquery-typed word.
Example:
1 2 3 4 5 |
gaussdb=# SELECT 'cat'::tsquery @> 'cat & rat'::tsquery AS RESULT; result -------- f (1 row) |
<@
Description: Specifies whether a tsquery-typed word is contained in another tsquery-typed word.
Example:
1 2 3 4 5 |
gaussdb=# SELECT 'cat'::tsquery <@ 'cat & rat'::tsquery AS RESULT; result -------- t (1 row) |
In addition to the preceding operators, the ordinary B-tree comparison operators (including = and <) are defined for types tsvector and tsquery.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.