lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoss Man (JIRA)" <>
Subject [jira] Commented: (LUCENE-573) Escaped quotes inside a phrase cause a ParseException
Date Sun, 20 Aug 2006 19:05:15 GMT
    [ ] 
Hoss Man commented on LUCENE-573:

> You assume that the queryparser unescapes the quotes inside 
> the phrase, but the queryparser does not unescape *any*
> escaped characters inside a phrase. You can see that in (2),
> where the escaped + (plus) character does not become 
> unescaped.

...I'm not sure if this is a fair comaprison.  Query parser may not unescape things like the
\+ in this example....
     foo "bar \+baz"
...but i believe that is because there is no reason for it to do so, if what you intended
was to match on the + character without a preceding s\ you could have just written...
     foo "bar +baz" the plus is already escaped by the nature of being inside the  phrase bounding quotes

this same justification does not hold for the double-quote character however ... there is
no way to inlcude a " character inside of a phrase without escaping, so it seems like query
parser should be unescaping it automatically for you.


> 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