On Oct 28, 2004, at 1:03 PM, Justin Swanhart wrote:
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);

That's not accurate API, but add you used pq.add(t), it still would presume that text is all a single term.


Chances are, though, that even getting the query to have the quotes is not going to work as you've probably lost the quotes during indexing. Check out the AnalysisParalysis page on the wiki and "analyze" your Analyzer and make sure you are indexing the text with the quotes (no built-in analyzer besides WhitespaceAnalyzer would do that for you).

        Erik


...



On Thu, 28 Oct 2004 12:02:48 -0400, Will Allen <[EMAIL PROTECTED]> 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- [EMAIL PROTECTED]&msgNo=7351

From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to