apache / apache/lucene

IllegalArgumentException in QueryParserBase.parse() [LUCENE-6703]

Open
#7,761 0 comments 0 reactions 0 assignees View on GitHub
affects-version:4.10.4 legacy-jira-priority:Major module:core/queryparser type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

I have encountered a very special case where parsing a certain String with the `MultiFieldQueryParser` causes an `IllegalArgumentException` thrown in the constructor of `org.apache.lucene.util.automaton.RegExp`. I would have expected a `ParseException` instead (as stated in the API doc).

```Java
QueryParser parser = new MultiFieldQueryParser(...);
parser.parse("/x)/");
```

The "evil" search string is **`/x)/`**.

---
Migrated from [LUCENE-6703](https://issues.apache.org/jira/browse/LUCENE-6703) by Oliver Becker

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with MultiFieldQueryParser.parse("/x)/") and trace where the IllegalArgumentException from org.apache.lucene.util.automaton.RegExp escapes the parser. Compare this behavior with the API's ParseException contract; done means the malformed query produces the documented exception instead.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.