From f6bd0da63bf40bc324eec6fd47f3d3d301f44dab Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Tue, 22 Mar 2016 17:08:10 +0300 Subject: [PATCH] Improve docs of pg_trgm changes Artur Zakirov, per gripe from Jeff Janes --- doc/src/sgml/pgtrgm.sgml | 58 +++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/doc/src/sgml/pgtrgm.sgml b/doc/src/sgml/pgtrgm.sgml index cdce17251f6..ef3c15d7053 100644 --- a/doc/src/sgml/pgtrgm.sgml +++ b/doc/src/sgml/pgtrgm.sgml @@ -153,15 +153,22 @@ - text %> text - boolean - - Returns 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 - pg_trgm.word_similarity_threshold parameter. - - + text <% text + boolean + + Returns 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 + pg_trgm.word_similarity_threshold parameter. + + + + text %> text + boolean + + Commutator of the <% operator. + + text <-> text real @@ -171,14 +178,23 @@ - - text <->> text - - real - - Returns the distance between the arguments, that is - one minus the word_similarity() value. - + + text <<-> text + + real + + Returns the distance between the arguments, that is + one minus the word_similarity() value. + + + + + text <->> text + + real + + Commutator of the <<-> operator. + @@ -215,8 +231,8 @@ Sets the current word similarity threshold that is used by - the %> operator. The threshold must be between - 0 and 1 (default is 0.6). + <% and %> operators. The threshold + must be between 0 and 1 (default is 0.6). @@ -283,7 +299,7 @@ SELECT t, t <-> 'word' AS dist SELECT t, word_similarity('word', t) AS sml FROM test_trgm - WHERE t %> 'word' + WHERE 'word' <% t ORDER BY sml DESC, t; This will return all values in the text column that have a word @@ -295,7 +311,7 @@ SELECT t, word_similarity('word', t) AS sml A variant of the above query is -SELECT t, t <->> 'word' AS dist +SELECT t, 'word' <<-> t AS dist FROM test_trgm ORDER BY dist LIMIT 10;