For: BooleanQuery bQuery=new BooleanQuery(); bQuery.add(messageQuery,true,false)
Use: BooleanQuery bQuery=new BooleanQuery(); bQuery.add(messageQuery, BooleanClause.Occur.MUST); Mapping is as follows: For add(query, true, false) use add(query, BooleanClause.Occur.MUST) For add(query, false, false) use add(query, BooleanClause.Occur.SHOULD) For add(query, false, true) use add(query, BooleanClause.Occur.MUST_NOT) --Rajesh Munavalli On 9/29/06, Ismail Siddiqui <[EMAIL PROTECTED]> wrote:
Hi, I have two pharase queries messageQuery = new PhraseQuery(); titleQuery = new PhraseQuery(); messageQuery.setSlop(3); titleQuery.setSlop(1); for (int i=0; i<search.length; i++){ messageQuery.add(new Term(MESSAGE,search[i])); titleQuery.add(new Term(TITLE,search[i])); } now i want to add these two query in Boolean Query.. I am using lucene 2.0 .. in book lucen in action .. i see an example like this BooleanQuery bQuery=new BooleanQuery(); bQuery.add(messageQuery,true,false) but dont apparently there is no add function in BooleanQuery class with these 3 arguments in lucene 2.x can some one please tell me how to combine two queries in BooleanQuery in lucene 2 thanks Ismail Siddiqui m