diff --git a/doc/src/sgml/textsearch.sgml b/doc/src/sgml/textsearch.sgml index b084a1853b..8438844451 100644 --- a/doc/src/sgml/textsearch.sgml +++ b/doc/src/sgml/textsearch.sgml @@ -401,6 +401,32 @@ SELECT phraseto_tsquery('the cats ate the rats'); but with more complex situations such as prefix-match patterns, a query of this form could be useful.) + + + For example when some word exist in different forms and therefore this forms get the + same position in tsvector, & operator inside phrase operator + can select phrases with only needed form of word. It will not count when + word complete is included with neither booking + nor book as in case of plain & outside phrase operator. + + +SELECT to_tsvector('english_hunspell', 'complete booking complete lunch'); + to_tsvector +----------------------------------------------- + 'book':2 'booking':2 'complete':1,3 'lunch':4 + +SELECT 'book:2 booking:2 complete:1,3 lunch:4'::tsvector @@ '(complete <-> (book & !booking))'::tsquery; + ?column? +---------- + f + +SELECT 'book:2 booking:2 complete:1,3 lunch:4'::tsvector @@ '(complete <-> book) & (complete <-> !booking)'::tsquery; + ?column? +---------- + t + + +