lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <>
Subject Re: classic.QueryParser - bug or new behavior?
Date Sun, 19 May 2013 19:25:59 GMT
Yeah, just go ahead and escape the slash, either with a backslash or by 
enclosing the whole term in quotes. Otherwise the slash (even embedded in 
the middle of a term!) indicates the start of a regex query term.

-- Jack Krupansky

-----Original Message----- 
From: Scott Smith
Sent: Sunday, May 19, 2013 2:50 PM
Subject: classic.QueryParser - bug or new behavior?

I just upgraded from lucene 4.1 to 4.2.1.  We believe we are seeing some 
different behavior.

I'm using org.apache.lucene.queryparser.classic.QueryParser.  If I pass the 
string "20110920/EXPIRED" (w/o quotes) to the parser, I get:

org.apache.lucene.queryparser.classic.ParseException: Cannot parse 
'20110920/EXPIRED': Lexical error at line 1, column 17.  Encountered: <EOF> 
after : "/EXPIRED"

We believe this used to work.

I tried googling for this and found something that said I should use 
QueryParser.escape() on the string before passing it to the parser. 
However, that seems to break phrase queries (e.g., "John Smith" - with the 
quotes; I assume it's escaping the double-quotes and doesn't realize it's a 

Since it is a forward slash, I'm confused why it would need escaping of any 
of the characters in the string with the "/EXPIRED".

Has anyone seen this?


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

View raw message