From bb140506df605fab58f48926ee1db1f80bdafb59 Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Thu, 7 Apr 2016 18:44:18 +0300 Subject: Phrase full text search. Patch introduces new text search operator (<-> or ) into tsquery. On-disk and binary in/out format of tsquery are backward compatible. It has two side effect: - change order for tsquery, so, users, who has a btree index over tsquery, should reindex it - less number of parenthesis in tsquery output, and tsquery becomes more readable Authors: Teodor Sigaev, Oleg Bartunov, Dmitry Ivanov Reviewers: Alexander Korotkov, Artur Zakirov --- src/backend/utils/adt/tsvector_parser.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/backend/utils/adt/tsvector_parser.c') diff --git a/src/backend/utils/adt/tsvector_parser.c b/src/backend/utils/adt/tsvector_parser.c index e2817082db8..d99405824d7 100644 --- a/src/backend/utils/adt/tsvector_parser.c +++ b/src/backend/utils/adt/tsvector_parser.c @@ -89,7 +89,15 @@ do { \ } \ } while (0) -#define ISOPERATOR(x) ( pg_mblen(x)==1 && ( *(x)=='!' || *(x)=='&' || *(x)=='|' || *(x)=='(' || *(x)==')' ) ) +/* phrase operator begins with '<' */ +#define ISOPERATOR(x) \ + ( pg_mblen(x) == 1 && ( *(x) == '!' || \ + *(x) == '&' || \ + *(x) == '|' || \ + *(x) == '(' || \ + *(x) == ')' || \ + *(x) == '<' \ + ) ) /* Fills gettoken_tsvector's output parameters, and returns true */ #define RETURN_TOKEN \ -- cgit v1.2.3