-----------------
'fat' & 'rat'
</screen>
Note that <function>plainto_tsquery</function> will not
recognize <type>tsquery</type> operators, weight labels,
or prefix-match labels in its input:
<screen>
SELECT plainto_tsquery('english', 'The Fat & Rats:C');
plainto_tsquery
---------------------
'fat' & 'rat' & 'c'
</screen>
Here, all the input punctuation was discarded.
</para>
<indexterm>
<primary>phraseto_tsquery</primary>
</indexterm>
<synopsis>
phraseto_tsquery(<optional> <replaceable class="parameter">config</replaceable> <type>regconfig</type>, </optional> <replaceable class="parameter">querytext</replaceable> <type>text</type>) returns <type>tsquery</type>
</synopsis>
<para>
<function>phraseto_tsquery</function> behaves much like
<function>plainto_tsquery</function>, except that it inserts
the <literal><-></literal> (FOLLOWED BY) operator between
surviving words instead of the <literal>&</literal> (AND) operator.
Also, stop words are not simply discarded, but are accounted for by
inserting <literal><<replaceable>N</replaceable>></literal> operators rather
than <literal><-></literal> operators. This function is useful
when searching for exact lexeme sequences, since the FOLLOWED BY
operators check lexeme order not just the presence of all the lexemes.
</para>
<para>
Example:
<screen>
SELECT phraseto_tsquery('english', 'The Fat Rats');
phraseto_tsquery
------------------
'fat' <-> 'rat'
</screen>
Like <function>plainto_tsquery</function>, the
<function>phraseto_tsquery</function> function will not
recognize <type>tsquery</type> operators, weight labels,
or prefix-match labels in its input:
<screen>
SELECT phraseto_tsquery('english', 'The Fat & Rats:C');
phraseto_tsquery
-----------------------------
'fat' <-> 'rat' <-> 'c'
</screen>
</para>
<synopsis>
websearch_to_tsquery(<optional> <replaceable class="parameter">config</replaceable> <type>regconfig</type>, </optional> <replaceable class="parameter">querytext</replaceable> <type>text</type>) returns <type>tsquery</type>
</synopsis>
<para>
<function>websearch_to_tsquery</function> creates a <type>tsquery</type>
value from <replaceable>querytext</replaceable> using an alternative
syntax in which simple unformatted text is a valid query.
Unlike <function>plainto_tsquery</function>
and <function>phraseto_tsquery</function>, it also recognizes certain
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:
<itemizedlist spacing="compact" mark="bullet">
<listitem>
<para>
<literal>unquoted text</literal>: text not inside quote marks will be
converted to terms separated by <literal>&</literal> operators, as
if processed by <function>plainto_tsquery</function>.
</para>
</listitem>
<listitem>
<para>
<literal>"quoted text"</literal>: text inside quote marks will be
converted to terms separated by <literal><-></literal>
operators, as if processed by <function>phraseto_tsquery</function>.
</para>
</listitem>
<listitem>
<para>
<literal>OR</literal>: the word <quote>or</quote> will be converted to
the <literal>|</literal> operator.
</para>
</listitem>
<listitem>
<para>
<literal>-</literal>: a dash will be converted to
the <literal>!</literal> operator.
</para>
</listitem>
</itemizedlist>
Other punctuation is ignored. So
like <function>plainto_tsquery</function>
and <function>phraseto_tsquery</function>,
the <function>websearch_to_tsquery</function> function will not
recognize <type>tsquery</type> operators, weight labels, or prefix-match
labels in its input.