I am new to Lucene and am having problems with booleanQueries. How do you write Boolean OR and AND queries?

Is this an OR query

booleanQuery.add(query1, BooleanClause.Occur.SHOULD);
booleanQuery.add(query2, BooleanClause.Occur.SHOULD);

and is this an AND query

booleanQuery.add(query1, BooleanClause.Occur.MUST);
booleanQuery.add(query2, BooleanClause.Occur.MUST);

Is there a problem writing it this way so I can change between the two by setting booleanANDSearch to true or false

booleanQuery.add(query1,(booleanANDSearch?BooleanClause.Occur.MUST:BooleanClause.Occur.SHOULD));
booleanQuery.add(query2,(booleanANDSearch?BooleanClause.Occur.MUST:BooleanClause.Occur.SHOULD));

Also, when I call booleanQuery.toString(), I am getting this:

(upc:creatine description:creatine content:creatine) (brand:gluten brand:free) (category:alc category:beer)

It looks like each grouping is a query but how are the queries connected, with 
AND, OR or NOT?

--
Thanks,

Warren Bell

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to