lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Busch (JIRA)" <>
Subject [jira] Commented: (LUCENE-573) Escaped quotes inside a phrase cause a ParseException
Date Wed, 08 Nov 2006 00:40:54 GMT
    [ ] 
Michael Busch commented on LUCENE-573:

Sorry, it took me a while to take care of this patch.

You are right, my patch only prevents the ParseException to be thrown. However, it is still
not possible to search for a phrase query that contains quotes.

I think the simple solution is to call discardEscapeChar(String) for the phrase string. Then
*all* escaped characters within a phrase become unescaped.

Now the question is again (Yonik raised it already): Do we want this behavior or do we rather
want to maintain backward compatibility for already existing phrase queries that include a
backslash? If we prefer compatibility over consistency then one solution would be to add a
new method discardEscapeChar(String, char[]) that only unescapes certain characters, in this
case " and \.

If we can make a decision here I'm happy to provide a new patch.

> Escaped quotes inside a phrase cause a ParseException
> -----------------------------------------------------
>                 Key: LUCENE-573
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: QueryParser
>    Affects Versions: 1.9
>         Environment: Debian Sarge, Sun JDK 1.4.2
>            Reporter: Tomislav Gountchev
>            Priority: Minor
>         Attachments: escaped_quotes_inside_phrases.patch
> QueryParser cannot handle escaped quotes when inside a phrase. Escaped quotes not in
a phrase are not a problem. This can be added to TestQueryParser.testEscaped() to demonstrate
the issue - the second assert throws an exception:
> assertQueryEquals("a \\\"b c\\\" d", a, "a \"b c\" d");
> assertQueryEquals("\"a \\\"b c\\\" d\"", a, "\"a \"b c\" d\"");
> See also this thread:

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


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

View raw message