question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

INVALID_SYNTAX_CANNOT_PARSE for at sign (@)

See original GitHub issue

Description

Since release 9.1.0, Lucene’s SyntaxParser have been uncapable to parse @ in a query, throwing a Syntax Error (INVALID_SYNTAX_CANNOT_PARSE). Version 9.0.0 is the last I tested that still can parse this character.

Two similar examples that throw INVALID_SYNTAX_CANNOT_PARSE in 9.1.0, but not in 9.0.0:

  • \\ an@tomy
  • \\ @natomy

Leaving some log dump here:

Syntax Error, cannot parse \\ an@tomy:  
INVALID_SYNTAX_CANNOT_PARSE: Syntax Error, cannot parse \\ an@tomy:  
	at org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.generateParseException(StandardSyntaxParser.java:2093)
	at org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.jj_consume_token(StandardSyntaxParser.java:1961)
	at org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.TopLevelQuery(StandardSyntaxParser.java:115)
	at org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser.parse(StandardSyntaxParser.java:92)
	at org.apache.lucene.queryparser.flexible.core.QueryParserHelper.parse(QueryParserHelper.java:214)
	at org.apache.lucene.queryparser.flexible.standard.StandardQueryParser.parse(StandardQueryParser.java:280)
        ...

Version and environment details

  • JDK: temurin-17.0.3
  • OS: MacOS Monterey 12.6 and alpine-java17:latest (docker image)
  • Lucene: 9.1.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rmuircommented, Sep 21, 2022

not a bug, but related to new features added to the parser. see the associated message in MIGRATE.txt:

## Minor syntactical changes in StandardQueryParser (Lucene 9.1)

LUCENE-10223 adds interval functions and min-should-match support to StandardQueryParser. This
means that interval function prefixes ("fn:") and the '@' character after parentheses will
parse differently than before. If you need the exact previous behavior, clone the StandardSyntaxParser from the previous version of Lucene and create a custom query parser
with that parser.
0reactions
gcbaptistacommented, Sep 23, 2022

OK, thank you very much for the clarification 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid Syntax in Python: Common Reasons for SyntaxError
If the interpreter can't parse your Python code successfully, then this means that you used invalid syntax somewhere in your code.
Read more >
black fails to parse a seemingly fine Python file in safe mode ...
Describe the bug It looks like a regression. We get the following error by running black --safe with Black versions 20.8b1 and 19.10b0...
Read more >
GraphQLError: Syntax Error: Cannot parse the unexpected ...
GraphQLError: Syntax Error: Cannot parse the unexpected character " ... function() { server.start(() => console.log('Server is running on ...
Read more >
How to Fix the Syntax Error in WordPress - WPBeginner
I have changed my theme's functions.php file a little bit and now I have an syntax error. Functiıns.php parse error. I can't access...
Read more >
Troubleshooting rules - Semgrep
The Semgrep pattern if $X < 5 is invalid, and needs to be changed to a complete statement with a wildcard: if $X...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found