lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Rauch (JIRA)" <>
Subject [jira] [Commented] (LUCENE-4878) Regular expression syntax with MultiFieldQueryParser causes assert/NPE
Date Mon, 25 Mar 2013 05:15:15 GMT


Adam Rauch commented on LUCENE-4878:

A simple example that reproduces the assertion:

    // Turn on asserts
    ClassLoader loader = ClassLoader.getSystemClassLoader();

        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.queryparser.classic.QueryParserBase.newRegexpQuery(
    at org.apache.lucene.queryparser.classic.QueryParserBase.getRegexpQuery(
    at org.apache.lucene.queryparser.classic.QueryParserBase.handleBareTokenQuery(
    at org.apache.lucene.queryparser.classic.QueryParser.Term(
    at org.apache.lucene.queryparser.classic.QueryParser.Clause(
    at org.apache.lucene.queryparser.classic.QueryParser.Query(
    at org.apache.lucene.queryparser.classic.QueryParser.TopLevelQuery(
    at org.apache.lucene.queryparser.classic.QueryParserBase.parse(
    at QueryParserException.main(

> Regular expression syntax with MultiFieldQueryParser causes assert/NPE
> ----------------------------------------------------------------------
>                 Key: LUCENE-4878
>                 URL:
>             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:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message