lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomi <t...@gountchev.net>
Subject ParseException with escaped quotes in a phrase
Date Fri, 19 May 2006 00:29:28 GMT

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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message