</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal><<<-></literal> <type>text</type>
<returnvalue>real</returnvalue>
</para>
<para>
Returns the <quote>distance</quote> between the arguments, that is
one minus the <function>strict_word_similarity()</function> value.
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal><->>></literal> <type>text</type>
<returnvalue>real</returnvalue>
</para>
<para>
Commutator of the <literal><<<-></literal> operator.
</para></entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id="pgtrgm-guc">
<title>GUC Parameters</title>
<variablelist>
<varlistentry id="guc-pgtrgm-similarity-threshold" xreflabel="pg_trgm.similarity_threshold">
<term>
<varname>pg_trgm.similarity_threshold</varname> (<type>real</type>)
<indexterm>
<primary><varname>pg_trgm.similarity_threshold</varname> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
Sets the current similarity threshold that is used by the <literal>%</literal>
operator. The threshold must be between 0 and 1 (default is 0.3).
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-pgtrgm-word-similarity-threshold" xreflabel="pg_trgm.word_similarity_threshold">
<term>
<varname>pg_trgm.word_similarity_threshold</varname> (<type>real</type>)
<indexterm>
<primary><varname>pg_trgm.word_similarity_threshold</varname> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
Sets the current word similarity threshold that is used by the
<literal><%</literal> and <literal>%></literal> operators. The threshold
must be between 0 and 1 (default is 0.6).
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-pgtrgm-strict-word-similarity-threshold" xreflabel="pg_trgm.strict_word_similarity_threshold">
<term>
<varname>pg_trgm.strict_word_similarity_threshold</varname> (<type>real</type>)
<indexterm>
<primary><varname>pg_trgm.strict_word_similarity_threshold</varname> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
Sets the current strict word similarity threshold that is used by the
<literal><<%</literal> and <literal>%>></literal> operators. The threshold
must be between 0 and 1 (default is 0.5).
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="pgtrgm-index">
<title>Index Support</title>
<para>
The <filename>pg_trgm</filename> module provides GiST and GIN index
operator classes that allow you to create an index over a text column for
the purpose of very fast similarity searches. These index types support
the above-described similarity operators, and additionally support
trigram-based index searches for <literal>LIKE</literal>, <literal>ILIKE</literal>,
<literal>~</literal>, <literal>~*</literal> and <literal>=</literal> queries.
The similarity comparisons are case-insensitive in a default build of
<filename>pg_trgm</filename>.
Inequality operators are not supported.
Note that those indexes may not be as efficient as regular B-tree indexes
for equality operator.
</para>
<para>
Example:
<programlisting>
CREATE TABLE test_trgm (t text);
CREATE INDEX trgm_idx ON test_trgm USING GIST (t gist_trgm_ops);
</programlisting>
or
<programlisting>
CREATE INDEX trgm_idx ON test_trgm USING GIN (t gin_trgm_ops);
</programlisting>
</para>
<para>
<literal>gist_trgm_ops</literal> GiST opclass approximates a set of
trigrams as a bitmap signature. Its optional integer parameter
<literal>siglen</literal>