lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Swanhart <greenl...@gmail.com>
Subject Re: Searching for a phrase that contains quote character
Date Thu, 28 Oct 2004 17:03:52 GMT
Have you tried making a term query by hand and testing to see if it works?  

Term t = new Term("field", "this is a \"test\"");
PhraseQuery pq = new PhraseQuery(t);
...



On Thu, 28 Oct 2004 12:02:48 -0400, Will Allen <wallen@cyveillance.com> wrote:
> 
> I am having this same problem, but cannot find any help!
> 
> I have a keyword field that sometimes includes double quotes, but I am unable to search
for that field because the escape for a quote doesnt work!
> 
> I have tried a number of things:
> 
> myfield:"lucene is \"cool\""
> 
> AND
> 
> myfield:"lucene is \\"cool\\""
> 
> http://issues.apache.org/eyebrowse/ReadMsg?listName=lucene-user@jakarta.apache.org&msgNo=7351
> 
> From: danrapp@comcast.net <danrapp@comcast.net>
> Subject: Searching for a phrase that contains quote character
> Date: Wed, 24 Mar 2004 21:25:16 +0000
> 
> 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
> 
>

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


Mime
View raw message