lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Busch (JIRA)" <>
Subject [jira] Updated: (LUCENE-573) Escaped quotes inside a phrase cause a ParseException
Date Fri, 17 Nov 2006 19:39:43 GMT
     [ ]

Michael Busch updated LUCENE-573:

    Attachment: LUCENE-573_new.patch

I actually found another problem in the current unescaping code:
junit.framework.AssertionFailedError: Query /a\\\+b/ yielded /a\\+b/, expecting /a\+b/

The reason is that the method discardEscapeChar() cannot handle an escaped backslash followed
by another escaped character.

I attach a new patch that includes the following:
- the QueryParser unescapes any escaped characters inside a phrase and can handle escaped
quotes inside phrases
- for consistency reasons unescaping now is also being done in quoted range queries
- new implementation of discardEscapeChar() that solves the above mentioned problem (escaped
backslash followed by another escaped character)
- new tests for TestQueryParser that tests the changes

All unit tests pass.

> 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
>         Assigned To: Michael Busch
>            Priority: Minor
>         Attachments: LUCENE-573_new.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