Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 459f407

Browse files
committed
Doc: improve documentation of websearch_to_tqsuery().
It wasn't totally clear about punctuation other than what's specified being ignored. Pavel Borisov and Tom Lane Discussion: https://postgr.es/m/CALT9ZEFsBdsogVjG40Z4KfM1Um=wj1FE9hJ00GK3oVfzz0sFNg@mail.gmail.com
1 parent f057980 commit 459f407

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

doc/src/sgml/func.sgml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11381,11 +11381,12 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
1138111381
<replaceable>query</replaceable> <type>text</type> )
1138211382
<returnvalue>tsquery</returnvalue>
1138311383
<?br?>
11384-
Converts text to a <type>tsquery</type>, normalizing words according to
11385-
the specified or default configuration. Quoted word sequences are
11386-
converted to phrase tests, and the word <quote>or</quote> is
11387-
understood as producing an OR operator. This approximates the
11388-
behavior of some common web search tools.
11384+
Converts text to a <type>tsquery</type>, normalizing words according
11385+
to the specified or default configuration. Quoted word sequences are
11386+
converted to phrase tests. The word <quote>or</quote> is understood
11387+
as producing an OR operator, and a dash produces a NOT operator;
11388+
other punctuation is ignored.
11389+
This approximates the behavior of some common web search tools.
1138911390
<?br?>
1139011391
<literal>websearch_to_tsquery('english', '"fat rat" or cat dog')</literal>
1139111392
<returnvalue>'fat' &lt;-&gt; 'rat' | 'cat' &amp; 'dog'</returnvalue>

doc/src/sgml/textsearch.sgml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ SELECT plainto_tsquery('english', 'The Fat &amp; Rats:C');
913913
'fat' &amp; 'rat' &amp; 'c'
914914
</screen>
915915

916-
Here, all the input punctuation was discarded as being space symbols.
916+
Here, all the input punctuation was discarded.
917917
</para>
918918

919919
<indexterm>
@@ -969,16 +969,16 @@ websearch_to_tsquery(<optional> <replaceable class="parameter">config</replaceab
969969
syntax in which simple unformatted text is a valid query.
970970
Unlike <function>plainto_tsquery</function>
971971
and <function>phraseto_tsquery</function>, it also recognizes certain
972-
operators. Moreover, this function should never raise syntax errors,
972+
operators. Moreover, this function will never raise syntax errors,
973973
which makes it possible to use raw user-supplied input for search.
974974
The following syntax is supported:
975+
975976
<itemizedlist spacing="compact" mark="bullet">
976977
<listitem>
977978
<para>
978979
<literal>unquoted text</literal>: text not inside quote marks will be
979980
converted to terms separated by <literal>&amp;</literal> operators, as
980-
if processed by
981-
<function>plainto_tsquery</function>.
981+
if processed by <function>plainto_tsquery</function>.
982982
</para>
983983
</listitem>
984984
<listitem>
@@ -990,18 +990,26 @@ websearch_to_tsquery(<optional> <replaceable class="parameter">config</replaceab
990990
</listitem>
991991
<listitem>
992992
<para>
993-
<literal>OR</literal>: logical or will be converted to
993+
<literal>OR</literal>: the word <quote>or</quote> will be converted to
994994
the <literal>|</literal> operator.
995995
</para>
996996
</listitem>
997997
<listitem>
998998
<para>
999-
<literal>-</literal>: the logical not operator, converted to the
999+
<literal>-</literal>: a dash will be converted to
10001000
the <literal>!</literal> operator.
10011001
</para>
10021002
</listitem>
10031003
</itemizedlist>
1004+
1005+
Other punctuation is ignored. So
1006+
like <function>plainto_tsquery</function>
1007+
and <function>phraseto_tsquery</function>,
1008+
the <function>websearch_to_tsquery</function> function will not
1009+
recognize <type>tsquery</type> operators, weight labels, or prefix-match
1010+
labels in its input.
10041011
</para>
1012+
10051013
<para>
10061014
Examples:
10071015
<screen>

0 commit comments

Comments
 (0)