</entry>
</row>
<row>
- <entry><type>text</> <literal>%></literal> <type>text</></entry>
- <entry><type>boolean</type></entry>
- <entry>
- Returns <literal>true</> if its first argument has the similar word in
- the second argument and they have a similarity that is greater than the
- current word similarity threshold set by
- <varname>pg_trgm.word_similarity_threshold</> parameter.
- </entry>
- </row>
+ <entry><type>text</> <literal><%</literal> <type>text</></entry>
+ <entry><type>boolean</type></entry>
+ <entry>
+ Returns <literal>true</> if its first argument has the similar word in
+ the second argument and they have a similarity that is greater than the
+ current word similarity threshold set by
+ <varname>pg_trgm.word_similarity_threshold</> parameter.
+ </entry>
+ </row>
+ <row>
+ <entry><type>text</> <literal>%></literal> <type>text</></entry>
+ <entry><type>boolean</type></entry>
+ <entry>
+ Commutator of the <literal><%</> operator.
+ </entry>
+ </row>
<row>
<entry><type>text</> <literal><-></literal> <type>text</></entry>
<entry><type>real</type></entry>
</entry>
</row>
<row>
- <entry>
- <type>text</> <literal><->></literal> <type>text</>
- </entry>
- <entry><type>real</type></entry>
- <entry>
- Returns the <quote>distance</> between the arguments, that is
- one minus the <function>word_similarity()</> value.
- </entry>
+ <entry>
+ <type>text</> <literal><<-></literal> <type>text</>
+ </entry>
+ <entry><type>real</type></entry>
+ <entry>
+ Returns the <quote>distance</> between the arguments, that is
+ one minus the <function>word_similarity()</> value.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <type>text</> <literal><->></literal> <type>text</>
+ </entry>
+ <entry><type>real</type></entry>
+ <entry>
+ Commutator of the <literal><<-></> operator.
+ </entry>
</row>
</tbody>
</tgroup>
<listitem>
<para>
Sets the current word similarity threshold that is used by
- the <literal>%></> operator. The threshold must be between
- 0 and 1 (default is 0.6).
+ <literal><%</> and <literal>%></> operators. The threshold
+ must be between 0 and 1 (default is 0.6).
</para>
</listitem>
</varlistentry>
<programlisting>
SELECT t, word_similarity('<replaceable>word</>', t) AS sml
FROM test_trgm
- WHERE t %> '<replaceable>word</>'
+ WHERE '<replaceable>word</>' <% t
ORDER BY sml DESC, t;
</programlisting>
This will return all values in the text column that have a word
<para>
A variant of the above query is
<programlisting>
-SELECT t, t <->> '<replaceable>word</>' AS dist
+SELECT t, '<replaceable>word</>' <<-> t AS dist
FROM test_trgm
ORDER BY dist LIMIT 10;
</programlisting>