How to give AND condition in MultiFieldSearchQueryParser?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to give AND condition in MultiFieldSearchQueryParser?

Vikas Khengare
Hi

 

            I want to search in multiple fields with "AND" condition
that is, If I have fields for employee

 

Field ("empNum","EC02261");

Field ("empPurchaseDept","john");

Field ("empAccountDept","john");

Field ("age","Aegentina");

 

Now I want to search in "PurchaseDept" & "AccountDept" for empName But
Only if that employee exist in both department.

So If I will search for john it should give me corresponding document
because it contents in both fields.

 

I can use MultiFieldSearchQueryParser. But what about "AND" condition.
if I search then it should present in both fields i.e. Purchase &
Account then n then it should return result.

 

Can I use BooleanClause.Occur.MUST?

========================================================================
==========================