[
https://issues.apache.org/jira/browse/LUCENE-4878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13612393#comment-13612393
]
Adam Rauch commented on LUCENE-4878:
------------------------------------
A simple example that reproduces the assertion:
// Turn on asserts
ClassLoader loader = ClassLoader.getSystemClassLoader();
loader.setDefaultAssertionStatus(true);
try
{
Analyzer analyzer = new WhitespaceAnalyzer(Version.LUCENE_41);
QueryParser parser = new MultiFieldQueryParser(Version.LUCENE_41, new
String[]{"title", "body"}, analyzer);
Query query = parser.parse("/study/");
}
catch (ParseException e)
{
System.out.println("Syntax error, please rephrase your query");
}
This produces:
Exception in thread "main" java.lang.AssertionError
at org.apache.lucene.search.MultiTermQuery.<init>(MultiTermQuery.java:252)
at org.apache.lucene.search.AutomatonQuery.<init>(AutomatonQuery.java:65)
at org.apache.lucene.search.RegexpQuery.<init>(RegexpQuery.java:90)
at org.apache.lucene.search.RegexpQuery.<init>(RegexpQuery.java:79)
at org.apache.lucene.search.RegexpQuery.<init>(RegexpQuery.java:69)
at
org.apache.lucene.queryparser.classic.QueryParserBase.newRegexpQuery(QueryParserBase.java:790)
at
org.apache.lucene.queryparser.classic.QueryParserBase.getRegexpQuery(QueryParserBase.java:1005)
at
org.apache.lucene.queryparser.classic.QueryParserBase.handleBareTokenQuery(QueryParserBase.java:1075)
at
org.apache.lucene.queryparser.classic.QueryParser.Term(QueryParser.java:359)
at
org.apache.lucene.queryparser.classic.QueryParser.Clause(QueryParser.java:258)
at
org.apache.lucene.queryparser.classic.QueryParser.Query(QueryParser.java:182)
at
org.apache.lucene.queryparser.classic.QueryParser.TopLevelQuery(QueryParser.java:171)
at
org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:120)
at QueryParserException.main(QueryParserException.java:21)
> Regular expression syntax with MultiFieldQueryParser causes assert/NPE
> ----------------------------------------------------------------------
>
> Key: LUCENE-4878
> URL: https://issues.apache.org/jira/browse/LUCENE-4878
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/queryparser
> Affects Versions: 4.1
> Reporter: Adam Rauch
>
> Using regex syntax causes MultiFieldQueryParser.parse() to throw an
> AssertionError (if asserts are on) or causes subsequent searches using the
> returned Query instance to throw NullPointerException (if asserts are off).
> Simon Willnauer's comment on the java-user alias: "This is in-fact a bug in
> the MultiFieldQueryParser [...] MultifieldQueryParser should override
> getRegexpQuery but it doesn't"
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]