lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Noll <dan...@nuix.com>
Subject Re: NOT queries
Date Tue, 21 Nov 2006 22:26:43 GMT
Antony Bowesman wrote:
> Hi,
> 
> I'm writing a mapping mechanism between an existing search interface and 
> Lucene and wondered how to support a single NOT/- query.
> 
> Given the query "-attribute", then from an ealier comment by Chris 
> Hostetter where he says "you can't have a negative clause in isolation 
> by itself", I assume that you first have to create a BooleanClause that 
> finds everything and then another Clause that removes the "attribute".
> 
> Is this right or is there another way to do it?

That's certainly how we do it... a BooleanClause with a 
MatchAllDocsQuery as default and the desired prohibited query.

You can subclass QueryParser to make this happen automatically (and I 
believe I've posted code about this at least once on the list already.)

Daniel


-- 
Daniel Noll

Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia    Ph: +61 2 9280 0699
Web: http://nuix.com/                               Fax: +61 2 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.

---------------------------------------------------------------------
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