lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Not query help.
Date Wed, 24 Nov 2010 07:56:26 GMT
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: uwe@thetaphi.de


> -----Original Message-----
> From: Nabib El-Rahman [mailto:nabiber@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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message