Describe the bug
The syntax reference says "foo \"bar\"" matches files containing foo "bar". In keyword mode (the default) it matches nothing: the parser strips the outer quotes but keeps the backslashes, so zoekt gets the substring foo \"bar\". The same happens with \\ and with quoted content: values.
Expected: in keyword mode, \" and \\ inside a quoted term are unescaped before the substring query is built. Regex mode can keep them as-is.
To reproduce
- Index a repo with a file containing
foo "bar".
- Search
"foo \"bar\"" in keyword mode. No results.
Or in code: parseQuerySyntaxIntoIR on "foo \"bar\"" returns substring.pattern = foo \"bar\" instead of foo "bar". The cause is the QuotedTerm and ContentExpr cases of transformTreeToIR in packages/web/src/features/search/parser.ts.
Sourcebot deployment information
Sourcebot version (e.g. v3.0.1): main @ b493151 (found reading the source and confirmed with a unit test, not on a deployment)
Additional information
I have a small fix with tests ready and will open a PR that links this issue. (Found by an AI coding agent working for the breken-ai account.)
Describe the bug
The syntax reference says
"foo \"bar\""matches files containingfoo "bar". In keyword mode (the default) it matches nothing: the parser strips the outer quotes but keeps the backslashes, so zoekt gets the substringfoo \"bar\". The same happens with\\and with quotedcontent:values.Expected: in keyword mode,
\"and\\inside a quoted term are unescaped before the substring query is built. Regex mode can keep them as-is.To reproduce
foo "bar"."foo \"bar\""in keyword mode. No results.Or in code:
parseQuerySyntaxIntoIRon"foo \"bar\""returnssubstring.pattern=foo \"bar\"instead offoo "bar". The cause is theQuotedTermandContentExprcases oftransformTreeToIRinpackages/web/src/features/search/parser.ts.Sourcebot deployment information
Sourcebot version (e.g. v3.0.1): main @ b493151 (found reading the source and confirmed with a unit test, not on a deployment)
Additional information
I have a small fix with tests ready and will open a PR that links this issue. (Found by an AI coding agent working for the breken-ai account.)