diff options
Diffstat (limited to 'src/backend/utils/adt/tsquery.c')
-rw-r--r-- | src/backend/utils/adt/tsquery.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c index 690a80d7740..6f532188392 100644 --- a/src/backend/utils/adt/tsquery.c +++ b/src/backend/utils/adt/tsquery.c @@ -439,7 +439,7 @@ gettoken_query_websearch(TSQueryParserState state, int8 *operator, } else if (ISOPERATOR(state->buf)) { - /* or else gettoken_tsvector() will raise an error */ + /* ignore, else gettoken_tsvector() will raise an error */ state->buf++; state->state = WAITOPERAND; continue; @@ -476,15 +476,9 @@ gettoken_query_websearch(TSQueryParserState state, int8 *operator, break; case WAITOPERATOR: - if (t_iseq(state->buf, '"')) + if (*state->buf == '\0') { - /* - * put implicit AND after an operand and handle this quote - * in WAITOPERAND - */ - state->state = WAITOPERAND; - *operator = OP_AND; - return PT_OPR; + return PT_END; } else if (parse_or_operator(state)) { @@ -492,15 +486,17 @@ gettoken_query_websearch(TSQueryParserState state, int8 *operator, *operator = OP_OR; return PT_OPR; } - else if (*state->buf == '\0') + else if (ISOPERATOR(state->buf)) { - return PT_END; + /* ignore other operators in this state too */ + state->buf++; + continue; } else if (!t_isspace(state->buf)) { - /* put implicit AND after an operand */ - *operator = OP_AND; + /* insert implicit AND between operands */ state->state = WAITOPERAND; + *operator = OP_AND; return PT_OPR; } break; |