Home | About | Sematext search-lucene.com search-hadoop.com
 Search Lucene and all its subprojects:

Switch to Plain View
Lucene, mail # user - Searching for a phrase that contains quote character


Copy link to this message
-
Searching for a phrase that contains quote character
danrapp@... 2004-03-24, 21:25
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

---------------------------------------------------------------------
+
Will Allen 2004-10-28, 16:02