You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Dennis Walter <de...@gmail.com> on 2014/07/20 20:52:20 UTC
Bug in AnalyzingQueryParser Pattern
Hi there,
While reading the source code of AnalyzingQueryParser to understand what it
does, I think I found a bug in the regular expression used to detect
wildcards. It is defined as
// gobble escaped chars or find a wildcard character
private final Pattern wildcardPattern = Pattern.compile("(\\.)|([?*]+)");
The first group will match a literal dot ("."), while its intention seems
to be to match a backslash and a single character. So the expression should
instead be "(\\\\.)|([?*]+)"
Best Regards
Dennis
RE: Bug in AnalyzingQueryParser Pattern
Posted by "Allison, Timothy B." <ta...@mitre.org>.
Thank you, Dennis:
https://issues.apache.org/jira/i#browse/LUCENE-5839
From: Dennis Walter [mailto:dennis.walter@gmail.com]
Sent: Sunday, July 20, 2014 2:52 PM
To: dev@lucene.apache.org
Subject: Bug in AnalyzingQueryParser Pattern
Hi there,
While reading the source code of AnalyzingQueryParser to understand what it does, I think I found a bug in the regular expression used to detect wildcards. It is defined as
// gobble escaped chars or find a wildcard character
private final Pattern wildcardPattern = Pattern.compile("(\\.)|([?*]+)")<file:///\\.)|([%3f*]+)%22)>;
The first group will match a literal dot ("."), while its intention seems to be to match a backslash and a single character. So the expression should instead be "(\\\\.)|([?*]+)<file:///\\\.)|([%3f*]+)>"
Best Regards
Dennis