private List<FacetResult> facetsWithSearch() throws IOException {
  DirectoryReader indexReader=DirectoryReader.open(indexDir);
  IndexSearcher searcher=new IndexSearcher(indexReader);
  TaxonomyReader taxoReader=new DirectoryTaxonomyReader(taxoDir);
  FacetsCollector fc=new FacetsCollector();
  FacetsCollector.search(searcher,new MatchAllDocsQuery(),10,fc);
  List<FacetResult> results=new ArrayList<>();
  Facets facets=new FastTaxonomyFacetCounts(taxoReader,config,fc);
  results.add(facets.getTopChildren(10,"Author"));
  results.add(facets.getTopChildren(10,"Publish Date"));
  indexReader.close();
  taxoReader.close();
  return results;
}

private List < FacetResult > facetsWithSearch ( ) throws IOException { DirectoryReader indexReader = DirectoryReader . open ( indexDir ) ; IndexSearcher searcher = new IndexSearcher ( indexReader ) ; TaxonomyReader taxoReader = new DirectoryTaxonomyReader ( taxoDir ) ; FacetsCollector fc = new FacetsCollector ( ) ; FacetsCollector . search ( searcher , new MatchAllDocsQuery ( ) , 10 , fc ) ; List < FacetResult > results = new ArrayList < > ( ) ; Facets facets = new FastTaxonomyFacetCounts ( taxoReader , config , fc ) ; results . add ( facets . getTopChildren ( 10 , "Author" ) ) ; results . add ( facets . getTopChildren ( 10 , "Publish Date" ) ) ; indexReader . close ( ) ; taxoReader . close ( ) ; return results ; }
user runs a query and counts facets .
