Looks like QueryParser doesn't handle escaped quotes when inside a phrase:

public static void main(String[] args) throws Exception {
        String s = "Re:abcde jjj\"efgh asdf\" dsfdsf";
        System.out.println(s);
        QueryParser parser = new QueryParser("subject", new StandardAnalyzer());
        System.out.println(parser.parse(s));
        s = QueryParser.escape(s);
        System.out.println(s);
        System.out.println(parser.parse(s));
        s = "\""+s+"\"";
        System.out.println(s);
        System.out.println(parser.parse(s));
}

This throws a ParseException on the last line. This is with lucene 1.9.1 and
also from cvs. I was trying to implement an advanced search form where the
user can enter a text in a "search for this exact phrase" field, without
having to know the lucene syntax. My original idea was to use
QueryParser.escape() so that any punctuation is not interpreted, but
apparently quotes just have to be removed first.


Tomislav Gountchev

--
View this message in context: 
http://www.nabble.com/ParseException-with-escaped-quotes-in-a-phrase-t1647115.html#a4461350
Sent from the Lucene - Java Developer forum at Nabble.com.


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

Reply via email to