summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTeodor Sigaev2016-06-27 17:55:24 +0000
committerTeodor Sigaev2016-06-27 17:55:24 +0000
commit6734a1cacd44f5b731933cbc93182b135b167d0c (patch)
tree39b868e9a39f4301c7c9699b82f95f5979acb590 /src/include
parent3dbbd0f02a257d8d5c4cba14726371505f2e7266 (diff)
Change predecence of phrase operator.
<-> operator now have higher predecence than & (AND) operator. This change was motivated by unexpected difference of similar queries: 'a & b <-> c'::tsquery and 'b <-> c & a'. Before first query means (a & b) <-> c and second one - '(b <-> c) & a', now phrase operator evaluates first. Per suggestion from Tom Lane 32260.1465402409@sss.pgh.pa.us
Diffstat (limited to 'src/include')
-rw-r--r--src/include/tsearch/ts_type.h16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/include/tsearch/ts_type.h b/src/include/tsearch/ts_type.h
index 80eb75c14ee..d1f4114d21f 100644
--- a/src/include/tsearch/ts_type.h
+++ b/src/include/tsearch/ts_type.h
@@ -217,33 +217,19 @@ typedef struct
/*
* Legal values for QueryOperator.operator.
- * They should be ordered by priority! We assume that phrase
- * has highest priority, but this agreement is only
- * for query transformation! That's need to simplify
- * algorithm of query transformation.
*/
#define OP_NOT 1
#define OP_AND 2
#define OP_OR 3
-#define OP_PHRASE 4
+#define OP_PHRASE 4 /* highest code, tsquery_cleanup.c */
#define OP_COUNT 4
extern const int tsearch_op_priority[OP_COUNT];
-#define NOT_PHRASE_P 5 /* OP_PHRASE negation operations must have
- * greater priority in order to force infix()
- * to surround the whole OP_PHRASE expression
- * with parentheses. */
-
-#define TOP_PRIORITY 6 /* highest priority for val nodes */
-
/* get operation priority by its code*/
#define OP_PRIORITY(x) ( tsearch_op_priority[(x) - 1] )
/* get QueryOperator priority */
#define QO_PRIORITY(x) OP_PRIORITY(((QueryOperator *) (x))->oper)
-/* special case: get QueryOperator priority for correct printing !(a <-> b>) */
-#define PRINT_PRIORITY(x) \
- ( (((QueryOperator *) (x))->oper == OP_NOT) ? NOT_PHRASE_P : QO_PRIORITY(x) )
typedef struct
{