websearch_fix.patch

application/octet-stream

Filename: websearch_fix.patch
Type: application/octet-stream
Part: 0
Message: Re: BUG #16592: websearch_to_tsquery() returns queries that don't result in expected matches

Patch

Format: unified
File+
src/backend/utils/adt/tsquery.c 3 0
diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c
index 092e8a130bf..d49408af772 100644
--- a/src/backend/utils/adt/tsquery.c
+++ b/src/backend/utils/adt/tsquery.c
@@ -548,6 +548,9 @@ pushOperator(TSQueryParserState state, int8 oper, int16 distance)
 
 	Assert(oper == OP_NOT || oper == OP_AND || oper == OP_OR || oper == OP_PHRASE);
 
+	if (state->in_quotes && oper == OP_AND)
+		oper = OP_PHRASE;
+
 	tmp = (QueryOperator *) palloc0(sizeof(QueryOperator));
 	tmp->type = QI_OPR;
 	tmp->oper = oper;