dir.close();
taxDir.close();
}
private void verifyResults(Directory dir, Directory taxDir, FacetIndexingParams fip) throws IOException {
DirectoryReader reader1 = DirectoryReader.open(dir);
DirectoryTaxonomyReader taxReader = new DirectoryTaxonomyReader(taxDir);
IndexSearcher searcher = newSearcher(reader1);
FacetSearchParams fsp = new FacetSearchParams(fip, new CountFacetRequest(new CategoryPath("tag"), NUM_DOCS));
FacetsCollector collector = FacetsCollector.create(fsp, reader1, taxReader);
searcher.search(new MatchAllDocsQuery(), collector);
FacetResult result = collector.getFacetResults().get(0);
FacetResultNode node = result.getFacetResultNode();
for (FacetResultNode facet: node.subResults) {
int weight = (int)facet.value;
int label = Integer.parseInt(facet.label.components[1]);
//System.out.println(label + ": " + weight);
if (VERBOSE) {
System.out.println(label + ": " + weight);
}
assertEquals(NUM_DOCS ,weight);
}
reader1.close();
taxReader.close();
}