I have three fields say F1
, F2
, F3
. I want to find all the documents which have all three fields values as null. Can I achieve this by using BooleanQuery
? If I use MUST_NOT
clause for all three fields then It will not return the documents which have one of these fields as non null value.
I'm talking about implementing something like this
BooleanQuery booleanQuery = new BooleanQuery();
booleanQuery.add(new TermQuery(new Term(F1,"")), BooleanClause.Occur.MUST_NOT);
booleanQuery.add(new TermQuery(new Term(F2,"")), BooleanClause.Occur.MUST_NOT);
booleanQuery.add(new TermQuery(new Term(F3,"")), BooleanClause.Occur.MUST_NOT);
This surely is not going to work.How can i achieve this ? any help would be helpful.