Nice not to have to worry about performance. You say there is another question, but not what it is. The code you show looks like it should do what you want.
For anything non-trivial I prefer to build the queries directly in code rather than concatenating strings to be parsed, because I find it hard to work out the quotes and brackets and what the result will be. But your way is fine. -- Ian. On Mon, Oct 31, 2011 at 2:51 PM, deb.lucene <deb.luc...@gmail.com> wrote: > thanks Ian for your response. This is a one-time offline program so am not > bothered about the performance (i.e. speed etc.). > > one more question, there are some situations where I need to run a AND > clause (i.e. more than one phrase, such as "Apple" AND "Steve Jobs"). My > approach was something like :- > > ********************** > String searchString = "(" + phrase1 + ")" + " AND " + "(" + phrase2 + ")" ; > QueryParser queryParser = new QueryParser(Version.LUCENE_33,"content", new > StandardAnalyzer(Version.LUCENE_33)); > > Query query = queryParser.parse(searchString); > bQuery.add(query,BooleanClause.Occur.SHOULD); > > ********************** > thanks for the carrot2 pointer. > > -d > > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/multiple-phrase-search-for-topic-tp3461423p3468005.html > Sent from the Lucene - Java Users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org