QueryNodeParseException is thrown without proper Error information [LUCENE-6876]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
Whenever an Error is caught in parse() method of StandardSyntaxParser.java, a new instance of QueryNodeParseException is created without any Error Information(like errorToken, beginColumn, beginLine) and thrown. Following is the parse method:
```Java
public QueryNode parse(CharSequence query, CharSequence field) throws QueryNodeParseException {
ReInit(new FastCharStream(new StringReader(query.toString())));
try {
// TopLevelQuery is a Query followed by the end-of-input (EOF)
QueryNode querynode = TopLevelQuery(field);
return querynode;
}
catch (ParseException tme) {
tme.setQuery(query);
throw tme;
}
catch (Error tme) {
Message message = new MessageImpl(QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, query, tme.getMessage());
QueryNodeParseException e = new QueryNodeParseException(tme);
e.setQuery(query);
e.setNonLocalizedMessage(message);
throw e;
}
}
```
---
Migrated from [LUCENE-6876](https://issues.apache.org/jira/browse/LUCENE-6876) by Dominic Dsouza
Contributor guide
Research direction
Start in StandardSyntaxParser.java at the parse() method and compare the Error catch with the ParseException path. Trace QueryNodeParseException and the available error information such as errorToken, beginColumn, and beginLine. Done means errors from this path preserve the relevant parsing information when the exception is thrown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100