You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by da...@comcast.net on 2004/03/24 22:25:16 UTC

Searching for a phrase that contains quote character

I'd like to search for a phrase that contains the quote character. I've tried 
escaping the quote character, but am receiving a ParseException from the 
QueryParser:

For example to search for the phrase:

     this is a "test"

I'm trying the following

     QueryParser.parse("field:\"This is a \\\"test\\\"\"", "field", new StandardAnalyzer());

This results in:

org.apache.lucene.queryParser.ParseException: Lexical error at line 1, column 31.  Encountered: <EOF> after : ""
	at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:111)
	at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:87)
        ...

What is the proper way to accomplish this?

--Dan

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