Something like this will work: BooleanQuery query = new BooleanQuery(); query.add(new MatchAllDocsQuery(), Occur.MUST); query.add(new BooleanClause(termQuery, Occur.MUST_NOT));
On Fri, Mar 29, 2013 at 1:06 PM, Paul Bell <arach...@gmail.com> wrote: > Hi, > > I've done a few experiments in Lucene 4.2 with several different query > types: > > TermQuery > TermRangeQuery > NumericRangeQuery > WildcardQuery > PrefixQuery > MatchAllDocsQuery > > I think I more or less understand their behavior. > > But I'm missing something obvious: how does one do "not equal" type > queries? For example, suppose I want to find all documents whose "name" > field is not equal to a given value... > > Thank you. > > -Paul >