MatchAllDocsQuery. It's in the FAQ. http://wiki.apache.org/lucene-java/LuceneFAQ#How_does_one_determine_which_documents_do_not_have_a_certain_term.3F
-- Ian. On Wed, Oct 5, 2011 at 8:11 PM, Sam Jiang <sam.ji...@karoshealth.com> wrote: > Hi > > I'm struggling to figure out a way to query for the non-existence of some > fields. e.g. matches all documents that doesn't contain field X > > I tried: > BooleanQuery q = new BooleanQuery(); > q.add(new BooleanClause( > new TermQuery(new Term("fieldName", "*")), > Occur.MUST_NOT)); > > but then I realized the javadoc says it's impossible to query with a mere > MUST_NOT clause > > > A workaround I can think of is to add stub fields of name "", but this > increases the size of the index =/ > > any suggestions are welcome > > thanks > > > > -- > Sam Jiang | karoshealth > (っ゚Д゚;)っ hidden cat here > 7 Father David Bauer Drive, Suite 201 > Waterloo, ON, N2L 0A2, Canada > www.karoshealth.com > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org