> generate a query like the following:
> title:(+chemistry +"national curriculum")
I didn't understand what exactly you are asking but the query string is already
well-formatted. You can pass this string directly to the parse method of
QueryParser. The following four examples yields the same Query object.
String[] ar = {"title:(+chemistry +\"national curriculum\")"};
org.apache.lucene.queryParser.QueryParser.main(ar);
String[] ar1 = {"title:(chemistry AND \"national curriculum\")"};
org.apache.lucene.queryParser.QueryParser.main(ar1);
QueryParser qp = new QueryParser("title", new StandardAnalyzer());
Query q = qp.parse("chemistry AND \"national curriculum\"");
System.out.println(q.toString());
qp.setDefaultOperator(QueryParser.AND_OPERATOR);
q = qp.parse("chemistry \"national curriculum\"");
System.out.println(q.toString());
> its mention that it can be done using the QueryParser but
> unfortunately I can't find any reference in how to used it.
http://lucene.apache.org/java/2_4_1/queryparsersyntax.html
Just prepare a String according to descriptions in here, and pass it to the
parse method of QueryParser.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]