Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryParser raises SyntaxError when combining field prefix with nested searchstring #2381

Open
mrwunderbar666 opened this issue Apr 26, 2024 · 0 comments

Comments

@mrwunderbar666
Copy link

mrwunderbar666 commented Apr 26, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant