I have a BooleanQuery that looks like this:
BooleanQuery query = new BooleanQuery(); TermQuery term1 = new TermQuery(new Term(ID, "1234")); TermQuery term2 = new TermQuery(new Term(ID, "2344")); TermQuery term2 = new TermQuery(new Term(ID, "2323")); TermQuery termLocation = new TermQuery(new Term(LOCATION, "A1")); TermQuery termLanguage = new TermQuery(new Term(LANGUAGE, "ENU")); query.add(term1, BooleanClause.Occur.Should); query.add(term2, BooleanClause.Occur.Should); query.add(term3, BooleanClause.Occur.Should); query.add(termLocation, BooleanClause.Occur.MUST); query.add(termLanguage, BooleanClause.Occur.MUST); It produces this: ID: 1234 ID:2344 ID:2323 +LOCATION:A1 +LANGUAGE:ENU I just want results that have: ID: 1234 OR 2344 OR 2323 LOCATION: A1 LANGUAGE: ENU This query returns everything from my index. How would I create a query that will only return results the must have LOCATION and LANGUAGE and have only those three IDs.
