Can anyone help me with the formation of a BooleanQuery ?

I want a query of the form:

x AND ( a OR b OR c OR d)

 

The nearest I've managed to get is

 

query.add(new TermQuery(new Term(2, "x")),true,false);

Term term = null;

for (int i=1; i<numberOfNodes; i++){

term  = new Term(IndexLn2.CATEGORY_NODE, (String) nodes.get(i));

query.add(new TermQuery(term),false,false);

}

 

 

But this results in a query something similar to:

x AND a OR b OR c OR d

 

Close, but no cigar.

 

Thanks in advance,

Mike 
  
Michael Pickard 
Software Engineer 
Visit London 
6th Floor,
2 More London Riverside, London, SE1 2RR 
  
Tel: +44 (0)20 7234 5857 
Fax: +44 (0)20 7234 5751 
www.visitlondon.com   
  
  
Visit London is the official visitor organisation for London. Visit London is 
partly funded by Partnership, the Mayor's London Development Agency and the 
Association of London Government. 
The information contained in this e-mail is confidential and intended for the 
named recipient(s) only.  If you have received it in error, please notify the 
sender immediately and then delete the message.  If you are not the intended 
recipient, you must not use, disclose, copy or distribute this email. The views 
expressed in this e-mail are those of the individual and not of Visit London. 
We reserve the right to read and monitor any email or attachment entering or 
leaving our systems without prior notice. 
 
  

Reply via email to