Math.min(BooleanQuery.getMaxClauseCount(), terms.size()));
BooleanQuery bq = new BooleanQuery();
for (int j = 0; j < numTerms; j++) {
bq.add(new BooleanClause(new TermQuery(terms.get(j)), Occur.SHOULD));
}
TopDocs queryResult = searcher.search(new ConstantScoreQuery(bq), reader.maxDoc());
MatchAllDocsQuery matchAll = new MatchAllDocsQuery();
final TermsFilter filter = termsFilter(singleField, terms.subList(0, numTerms));;
TopDocs filterResult = searcher.search(matchAll, filter, reader.maxDoc());
assertEquals(filterResult.totalHits, queryResult.totalHits);