query text )
tsquery
- Converts text to a tsquery, normalizing words according to
- the specified or default configuration. Quoted word sequences are
- converted to phrase tests, and the word or
is
- understood as producing an OR operator. This approximates the
- behavior of some common web search tools.
+ Converts text to a tsquery, normalizing words according
+ to the specified or default configuration. Quoted word sequences are
+ converted to phrase tests. The word or
is understood
+ as producing an OR operator, and a dash produces a NOT operator;
+ other punctuation is ignored.
+ This approximates the behavior of some common web search tools.
websearch_to_tsquery('english', '"fat rat" or cat dog')
'fat' <-> 'rat' | 'cat' & 'dog'
'fat' & 'rat' & 'c'
- Here, all the input punctuation was discarded as being space symbols.
+ Here, all the input punctuation was discarded.
syntax in which simple unformatted text is a valid query.
Unlike plainto_tsquery
and phraseto_tsquery, it also recognizes certain
- operators. Moreover, this function should never raise syntax errors,
+ operators. Moreover, this function will never raise syntax errors,
which makes it possible to use raw user-supplied input for search.
The following syntax is supported:
+
unquoted text: text not inside quote marks will be
converted to terms separated by & operators, as
- if processed by
- plainto_tsquery.
+ if processed by plainto_tsquery.
- OR: logical or will be converted to
+ OR: the word or
will be converted to
the | operator.
- -: the logical not operator, converted to the
+ -: a dash will be converted to
the ! operator.
+
+ Other punctuation is ignored. So
+ like plainto_tsquery
+ and phraseto_tsquery,
+ the websearch_to_tsquery function will not
+ recognize tsquery operators, weight labels, or prefix-match
+ labels in its input.
+
Examples: