mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
Improve docs of pg_trgm changes
Artur Zakirov, per gripe from Jeff Janes
This commit is contained in:
parent
112a2d0615
commit
f6bd0da63b
@ -153,15 +153,22 @@
|
|||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><type>text</> <literal>%></literal> <type>text</></entry>
|
<entry><type>text</> <literal><%</literal> <type>text</></entry>
|
||||||
<entry><type>boolean</type></entry>
|
<entry><type>boolean</type></entry>
|
||||||
<entry>
|
<entry>
|
||||||
Returns <literal>true</> if its first argument has the similar word in
|
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
|
the second argument and they have a similarity that is greater than the
|
||||||
current word similarity threshold set by
|
current word similarity threshold set by
|
||||||
<varname>pg_trgm.word_similarity_threshold</> parameter.
|
<varname>pg_trgm.word_similarity_threshold</> parameter.
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><type>text</> <literal>%></literal> <type>text</></entry>
|
||||||
|
<entry><type>boolean</type></entry>
|
||||||
|
<entry>
|
||||||
|
Commutator of the <literal><%</> operator.
|
||||||
|
</entry>
|
||||||
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><type>text</> <literal><-></literal> <type>text</></entry>
|
<entry><type>text</> <literal><-></literal> <type>text</></entry>
|
||||||
<entry><type>real</type></entry>
|
<entry><type>real</type></entry>
|
||||||
@ -171,14 +178,23 @@
|
|||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>
|
<entry>
|
||||||
<type>text</> <literal><->></literal> <type>text</>
|
<type>text</> <literal><<-></literal> <type>text</>
|
||||||
</entry>
|
</entry>
|
||||||
<entry><type>real</type></entry>
|
<entry><type>real</type></entry>
|
||||||
<entry>
|
<entry>
|
||||||
Returns the <quote>distance</> between the arguments, that is
|
Returns the <quote>distance</> between the arguments, that is
|
||||||
one minus the <function>word_similarity()</> value.
|
one minus the <function>word_similarity()</> value.
|
||||||
</entry>
|
</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>
|
||||||
|
<type>text</> <literal><->></literal> <type>text</>
|
||||||
|
</entry>
|
||||||
|
<entry><type>real</type></entry>
|
||||||
|
<entry>
|
||||||
|
Commutator of the <literal><<-></> operator.
|
||||||
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
@ -215,8 +231,8 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Sets the current word similarity threshold that is used by
|
Sets the current word similarity threshold that is used by
|
||||||
the <literal>%></> operator. The threshold must be between
|
<literal><%</> and <literal>%></> operators. The threshold
|
||||||
0 and 1 (default is 0.6).
|
must be between 0 and 1 (default is 0.6).
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@ -283,7 +299,7 @@ SELECT t, t <-> '<replaceable>word</>' AS dist
|
|||||||
<programlisting>
|
<programlisting>
|
||||||
SELECT t, word_similarity('<replaceable>word</>', t) AS sml
|
SELECT t, word_similarity('<replaceable>word</>', t) AS sml
|
||||||
FROM test_trgm
|
FROM test_trgm
|
||||||
WHERE t %> '<replaceable>word</>'
|
WHERE '<replaceable>word</>' <% t
|
||||||
ORDER BY sml DESC, t;
|
ORDER BY sml DESC, t;
|
||||||
</programlisting>
|
</programlisting>
|
||||||
This will return all values in the text column that have a word
|
This will return all values in the text column that have a word
|
||||||
@ -295,7 +311,7 @@ SELECT t, word_similarity('<replaceable>word</>', t) AS sml
|
|||||||
<para>
|
<para>
|
||||||
A variant of the above query is
|
A variant of the above query is
|
||||||
<programlisting>
|
<programlisting>
|
||||||
SELECT t, t <->> '<replaceable>word</>' AS dist
|
SELECT t, '<replaceable>word</>' <<-> t AS dist
|
||||||
FROM test_trgm
|
FROM test_trgm
|
||||||
ORDER BY dist LIMIT 10;
|
ORDER BY dist LIMIT 10;
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user