if (node->valnode->qoperator.oper == OP_NOT)
{
+ NODE *orignode = node;
+
/* eliminate NOT sequence */
while (node->valnode->type == QI_OPR &&
node->valnode->qoperator.oper == node->right->valnode->qoperator.oper)
node = node->right->right;
}
- node->right = normalize_phrase_tree(node->right);
+ if (orignode != node)
+ /* current node isn't checked yet */
+ node = normalize_phrase_tree(node);
+ else
+ node->right = normalize_phrase_tree(node->right);
}
else if (node->valnode->qoperator.oper == OP_PHRASE)
{
(1 row)
-- Check stop word deletion, a and s are stop-words
+SELECT to_tsquery('english', '!(a & !b) & c');
+ to_tsquery
+------------
+ 'b' & 'c'
+(1 row)
+
+SELECT to_tsquery('english', '!(a & !b)');
+ to_tsquery
+------------
+ 'b'
+(1 row)
+
SELECT to_tsquery('english', '(1 <-> 2) <-> a');
to_tsquery
-------------
SELECT plainto_tsquery('english', 'foo bar') && 'asd | fg';
-- Check stop word deletion, a and s are stop-words
+SELECT to_tsquery('english', '!(a & !b) & c');
+SELECT to_tsquery('english', '!(a & !b)');
+
SELECT to_tsquery('english', '(1 <-> 2) <-> a');
SELECT to_tsquery('english', '(1 <-> a) <-> 2');
SELECT to_tsquery('english', '(a <-> 1) <-> 2');