Hi,

Do it like that:

BooleanQuery bq = new BooleanQuery();
bq.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST);
bq.add(new TermQuery(..), BooleanClause.Occur.MUST_NOT);

Uwe
-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: [email protected]


> -----Original Message-----
> From: Nabib El-Rahman [mailto:[email protected]]
> Sent: Wednesday, November 24, 2010 2:05 AM
> To: [email protected]
> Subject: Not query help.
> 
> Hi,
> 
> What I need is a Not TermQuery. I did not see one in the API, so I did the
> following:
> 
> Query query = new BooleanQuery(new BooleanClause(new TermQuery(..),
> BooleanClause.Occur.MUST_NOT)));
> 
> This did not produce the correct search result. Does anyone have any idea
on
> how to accomplish this?
> 
> And is here such a thing as NotTermQuery(..) ?
> 
> Thanks in advance!
> 
> -Nabib


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to