try to construct a query like : BooleanQuery mainquery = new BooleanQuery(); BooleanQuery query1 = new BooleanQuery(); BooleanQuery query2 = new BooleanQuery(); BooleanQuery query3 = new BooleanQuery();
queryParser = new QueryParser("title", new StandardAnalyzer()); query1 = queryParser.parse("business development"); query1.setBoost(3.0); mainquery.add(query1, Occur.SHOULD); queryParser = new QueryParser("Author", new StandardAnalyzer()); query2 = queryParser.parse("business development"); query2.setBoost(2.0); mainquery.add(query2, Occur.SHOULD); queryParser = new QueryParser("Description", new StandardAnalyzer()); query3 = queryParser.parse("business development"); mainquery.add(query3, Occur.SHOULD); use mainquery for your searching Prabin toostep.com On Fri, Dec 26, 2008 at 11:16 AM, vikas bucha <vikasbu...@gmail.com> wrote: > Hi, > > Merry Christmas and a Happy New Year to you all. > > I have an index with few fields. Title, Description, Author etc. > For a search query "business development", the equivalent lucene query I > build is: > > *(TITLE: business^9.00 OR AUTHOR: business^3.00 OR > DESCRIPTION:business^1.00) AND (TITLE: development^9.00 OR AUTHOR: > development^3.00 OR DESCRIPTION:development^1.00) > * > The expected result is to get all documents having both *business* and * > development* in the *TITLE* on top, followed by any one in TITLE and the > other in AUTHOR(if available) followed by both in AUTHOR and so on..., till > we get all docs having all the terms appearing anywhere in the document. > But > the results are completely different from the expectation. > > Please reply if you'd require any other information. > > This might be a trivial issue for the pros. I have pulled my hair at it for > a while. > Any help with what's wrong here would be highly appreciated. > > Thanks > Vikash. > -- > If there's no way out, then let's make one. >