lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Monsur Hossain" <mon...@monsur.com>
Subject RE: QueryParser exception on escaped backslash preceding ) character
Date Mon, 15 Aug 2005 19:05:41 GMT
We've actually been running into this sort of issue a lot, since we take a
user generated query from a web page and then push it into a QueryParser.
In general we've learned that escaping special characters is not enough to
create a well formed query.  Since our users aren't running complicated
queries, we decided instead to completely parse out any non-alphanumerics.
But we still have issues when, for example, someone will search for:

Portland, OR

And Lucene will interpret that "OR" as a special word, rather than "Oregon".
I'm wondering how others are dealing with this type of scenario.  If it'll
help, I can provide more queries that will cause errors similar to the one
below.

Thanks,
Monsur

 

> -----Original Message-----
> From: Matt Magoffin [mailto:apache.org@msqr.us] 
> Sent: Friday, August 12, 2005 10:30 AM
> 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: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message