tantivy
tantivy copied to clipboard
QueryParser raises SyntaxError when combining field prefix with nested searchstring
Describe the bug
- What did you do?
Given the query (A OR B) NOT (C OR D), I can produce a syntax error, where I believe should be none. These two variations work fine:
let query = query_parser.parse_query("(A OR B) NOT (C OR D)");
let query = query_parser.parse_query("((A OR B) NOT (C OR D))");
Let's say, I search in the field title then these two variations raise syntax errors:
let query = query_parser.parse_query("title:(A OR B) NOT (C OR D)");
// also wrapping the query in additional parentheses doesn't help
let query = query_parser.parse_query("title:((A OR B) NOT (C OR D))");
I would expect that the query parses just fine since this works:
let query = query_parser.parse_query("title:A OR B NOT (C OR D)");
Which version of tantivy are you using? Version 0.22.0 (via cargo)
EDIT:
I've also ran into issues with a query like this one
let query = query_parser.parse_query(r#" "a b" OR "a c"~3 NOT (d AND (e OR f)) "#);
I would propose to add unit tests to the query-grammar
I think my issue is related to this one: #1980
this seems to work on 0.25.. can probably be closed