Fetch all facets records against specfic field Lucene
<p>I'm beginner and started learning Lucene. Currently I 've implemented a Count Facets program in lucene 6.0.2 which display or output all facets field count. But now, want to search for a city "California" and in the result it will show all facets count w.r.t this query, How to do this...</p>

<p>Here is the code:</p>

<pre><code>public List&lt;FacetResult&gt; runSearch() throws IOException {
    DirectoryReader indexReader = DirectoryReader.open(indexDir);
    IndexSearcher searcher = new IndexSearcher(indexReader);
    TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoDir);
    FacetsConfig config = new FacetsConfig();

    FacetsCollector fc = new FacetsCollector();
    FacetsCollector.search(searcher, new MatchAllDocsQuery(), 10, fc);

    List&lt;FacetResult&gt; results = new ArrayList&lt;&gt;();

    Facets facets = new FastTaxonomyFacetCounts(taxoReader, config, fc);
    results.add(facets.getTopChildren(10, "city"));
    results.add(facets.getTopChildren(10, "make"));
    results.add(facets.getTopChildren(10, "year"));
    results.add(facets.getTopChildren(10, "model"));

    indexReader.close();
    taxoReader.close();

    return results;
}
</code></pre>