<literal>%</literal>
operator. The threshold must be between 0 and 1 (default is 0.3).
Returns the same value passed in.
(<emphasis>Deprecated</emphasis>; instead use <command>SET</command>
<varname>pg_trgm.similarity_threshold</varname>.)
</para></entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Consider the following example:
<programlisting>
# SELECT word_similarity('word', 'two words');
word_similarity
-----------------
0.8
(1 row)
</programlisting>
In the first string, the set of trigrams is
<literal>{" w"," wo","wor","ord","rd "}</literal>.
In the second string, the ordered set of trigrams is
<literal>{" t"," tw","two","wo "," w"," wo","wor","ord","rds","ds "}</literal>.
The most similar extent of an ordered set of trigrams in the second string
is <literal>{" w"," wo","wor","ord"}</literal>, and the similarity is
<literal>0.8</literal>.
</para>
<para>
This function returns a value that can be approximately understood as the
greatest similarity between the first string and any substring of the second
string. However, this function does not add padding to the boundaries of
the extent. Thus, the number of additional characters present in the
second string is not considered, except for the mismatched word boundaries.
</para>
<para>
At the same time, <function>strict_word_similarity</function>
selects an extent of words in the second string. In the example above,
<function>strict_word_similarity</function> would select the
extent of a single word <literal>'words'</literal>, whose set of trigrams is
<literal>{" w"," wo","wor","ord","rds","ds "}</literal>.
<programlisting>
# SELECT strict_word_similarity('word', 'two words'), similarity('word', 'words');
strict_word_similarity | similarity
------------------------+------------
0.571429 | 0.571429
(1 row)
</programlisting>
</para>
<para>
Thus, the <function>strict_word_similarity</function> function
is useful for finding the similarity to whole words, while
<function>word_similarity</function> is more suitable for
finding the similarity for parts of words.
</para>
<table id="pgtrgm-op-table">
<title><filename>pg_trgm</filename> Operators</title>
<tgroup cols="1">
<thead>
<row>
<entry role="func_table_entry"><para role="func_signature">
Operator
</para>
<para>
Description
</para></entry>
</row>
</thead>
<tbody>
<row>
<entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal>%</literal> <type>text</type>
<returnvalue>boolean</returnvalue>
</para>
<para>
Returns <literal>true</literal> if its arguments have a similarity
that is greater than the current similarity threshold set by
<varname>pg_trgm.similarity_threshold</varname>.
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal><%</literal> <type>text</type>
<returnvalue>boolean</returnvalue>
</para>
<para>
Returns <literal>true</literal> if the similarity between the trigram
set in the first argument and a continuous extent of an ordered trigram
set in the second argument is greater than the current word similarity
threshold set by <varname>pg_trgm.word_similarity_threshold</varname>
parameter.
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal>%></literal> <type>text</type>
<returnvalue>boolean</returnvalue>
</para>
<para>
Commutator of the <literal><%</literal> operator.
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">