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: u...@thetaphi.de > -----Original Message----- > From: Nabib El-Rahman [mailto:nabi...@gmail.com] > Sent: Wednesday, November 24, 2010 2:05 AM > To: java-user@lucene.apache.org > 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: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org