for the query:

<exp1> AND <exp2> OR <exp3> AND <exp4>

you could write this:

bq.Add(<term for exp1>, BooleanClause.Occur.MUST);
bq.Add(<term for exp2>, BooleanClause.Occur.MUST);
bq.Add(<term for exp3>, BooleanClause.Occur.SHOULD);
bq.Add(<term for exp4>, BooleanClause.Occur.MUST);

but, if you ment the following:

( <exp1> AND <exp2> ) OR ( <exp3> AND <exp4> )

then you would write:

bq1.Add(<term for exp1>, BooleanClause.Occur.MUST);
bq1.Add(<term for exp2>, BooleanClause.Occur.MUST);

bq2.Add(<term for exp3>, BooleanClause.Occur.MUST);
bq2.Add(<term for exp4>, BooleanClause.Occur.MUST);

bq3.Add(bq1, BooleanClause.Occur.SHOULD);
bq3.Add(bq2, BooleanClause.Occur.SHOULD);

and run the query using the composite boolean query "bq3".


-- Neal

-----Original Message-----
From: Sudhanya Chatterjee [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 08, 2008 3:47 AM
To: [email protected]
Subject: Query with boolean operators

Hi,

How to create queries with Boolean operators for untokenized fields?



Example query -

<exp1> AND <exp2> OR <exp3> AND <exp4>



Thanks,

Sudhanya


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.

Reply via email to