Hi, Try using Boolean Query. You can effectively use boolean operators using it. make seperate queries for each field. Boolean query is meant for having a series of queries with boolean operators defined.
For eg. lets say you have 3 diff queries A, B, C and you want a final query which behaves as A && (B || C) BooleanQuery query = new BooleanQuery(); BooleanQuery temp = new BooleanQuery(); temp.add(B, Occur.SHOULD); //Occur.SHOULD is equvalent to OR operator temp.add(C, Occur.SHOULD); query.add(A, Occur.MUST); //Occur.MUST is equivalent to an AND operator query.add(temp, Occur.Must); Now "query" = A && (B || C) Check out the documentation of Boolean Query. Prabin toostep.com On Mon, Nov 17, 2008 at 6:28 PM, Aditi Goyal <[EMAIL PROTECTED]> wrote: > Hi, > > Lets say I have an index with the following fields: > field1, field2, field3 and field4 where all the fields can have same > values. > > Now I want to search a document where "basket" and "apple" are part of the > whole document but "orange" is not. > > I have tried using MultiFieldQueryParser but it is not showing correct > results. > > I typed the command ("basket" AND "apple") NOT "orange" for the > MultiFieldQueryParser > > query = lucene.MultiFieldQueryParser.parse(command, fields, shoulds, > analyzer ) > hits = self.searcher.search(query) > > > Am I doing something wrong? Please help. > > Thanks, > Aditi >