Sorry for wrong version of code :( below is the correct code
FacetsCollector facetCollector = new FacetsCollector();
TopDocs topDocs = null;
TotalHitCountCollector totalHitCountCollector = null;
if (limit == 0) {
totalHitCountCollector = new TotalHitCountCollector();
indexSearcher
I think we should just make FacetsCollector robust if you pass a
limit=0? Under the hood, it should use a TotalHitCountCollector
instead. Can you open a Lucene Jira issue?
https://issues.apache.org/jira/browse/lucene
Alternatively, or maybe in addition, FacetsCollector should have
search methods