Lucene 3.6 will have a FieldValueFilter that can be negated:

Query q = new ConstantScoreQuery(new FieldValueFilter("field", true));

(see http://goo.gl/wyjxn)

Lucen 3.5 does not yet have it, you can download 3.6 snapshots from Jenkins:
http://goo.gl/Ka0gr

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


> -----Original Message-----
> From: Tim Eck [mailto:[email protected]]
> Sent: Thursday, February 16, 2012 9:59 PM
> To: [email protected]
> Subject: query for documents WITHOUT a field?
> 
> My apologies if this answer is readily available someplace, I've searched
> around and not found a definitive answer.
> 
> 
> 
> I'd like to run a query for documents that _do not_ contain particular
indexed
> fields to implement something like a SQL-like query where a column is
null.
> 
> 
> 
> I understand I could possibly use a magic value to represent "null", but
the data
> I'm searching doesn't led itself to reserving a value for null. I also
understand I
> could add an extra field to hold this boolean isNull state but would love
a better
> solution :-)
> 
> 
> 
> TIA
> 
> 



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

Reply via email to