I can verify that bad things are going on with backslashes and the
query parser in lucene 1.4.3
 foo:hi\\ ==> foo:hi\
 (foo:hi\\) ==> exception
 foo:"hi\\" ==> foo:hi\\
 foo:hi\\^3 ==> foo:hi\^3
foo:"hi \\ there" ==> foo:"hi \\ there"
foo:'hi there' ==> foo:'hi
foo:"\"" ==> exception
foo:hi\" ==> foo:hi"

So there appears to be no way to query for something with a quote and
a space in the same string...

IMHO, backslash should work as an escape inside quoted values.

-Yonik


On 8/12/05, Matt Magoffin <[EMAIL PROTECTED]> wrote:
> The strings are not coming from Java literals, actually, so I didn't think
> that was the problem.
> 
> Any other thoughts?
> 
> -- m@
> 
> > I think you are encountering a "double escape" problem in java literals.
> > QP is seeing a backslash in front of the ) and waiting for you to finish
> > the paren grouping.
> >
> > how are you passing that string to the QP, is it embedded in your java
> > code?  if so the java compiler is interpreting your \\ and your java  app
> > is never seeing it.
> >
> > : Date: Fri, 12 Aug 2005 07:30:19 -0700 (PDT)
> > : From: Matt Magoffin <[EMAIL PROTECTED]>
> > : Reply-To: java-user@lucene.apache.org
> > : To: java-user@lucene.apache.org
> > : Subject: QueryParser exception on escaped backslash preceding )
> > character
> > :
> > : When I try to parse a query with an escaped backslash character like
> > this
> > : (using Lucene 1.4.3):
> > :
> > : -id:20677 +(addr:Street143 AND zip:\\)
> > :
> > : the QueryParser thows an Exception:
> > :
> > : Encountered "<EOF>" at line 1, column 289.
> > :                     Was expecting one of: <AND> ... <OR> ...
> > :                     <NOT> ... "+" ... "-" ... "(" ... ")" ... "^" ...
> > :                     <QUOTED> ... <TERM> ...
> > :                     <PREFIXTERM> ... <WILDTERM> ... "[" ...
> > :                     "{" ... <NUMBER> ...
> > :
> > : However, if I insert a space between the backslash and the parenthesis:
> > :
> > : -id:20677 +(addr:Street143 AND zip:\\ )
> > :
> > : it works. Is this expected behavior or perhaps a bug in the QueryParser?
> > :
> > : -- m@
> > :
> > : ---------------------------------------------------------------------
> > : To unsubscribe, e-mail: [EMAIL PROTECTED]
> > : For additional commands, e-mail: [EMAIL PROTECTED]
> > :
> >
> >
> >
> > -Hoss
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to