Hi, just found a solution, but you have to know, what you want to count:
try { final SolrIndexSearcher s = rb.req.getSearcher(); final SolrQueryParser qp = new SolrQueryParser(rb.req.getSchema(), null); final String queryString = "entity_type:RELEASE"; final Query q = qp.parse(queryString); final DocListAndSet results = s.getDocListAndSet(q, (List<Query>) null, (Sort) null, rb.req.getStart(), rb.req.getLimit()); final NamedList counts = new NamedList(); for (String fc : ImmutableSet.of("entity_type:RELEASE", "entity_type:PRODUCT_NAME")) { counts.add(fc, s.numDocs(qp.parse(fc), results.docSet)); } // in counts you have your facet-counts } catch (ParseException pe) { pe.printStackTrace(); } -------- Original-Nachricht -------- > Datum: Thu, 06 Sep 2012 13:58:29 +0200 > Von: "Ralf Heyde" <ralf.he...@gmx.de> > An: solr-user@lucene.apache.org > Betreff: Facetting inside a custom component > Hello, > > i'm currently devoloping a custom component in Solr. > This component works fine. The problem I have is, I only have an access to > the searcher which gives me the option to fire e.g. BooleanQueries. > > This searcher gives me a result, which I have to iterate to calculate > informations which could be delivered by solr facets out of the box. > > The problem i'm facing with is, that there is no option for facetting. > There is an example on the Lucene here: > http://lucene.apache.org/core/4_0_0-BETA/facet/org/apache/lucene/facet/doc-files/userguide.html > > The problem is, that i have no taxonomyDir / i dont know, where to get it. > TaxonomyReader taxo = new DirectoryTaxonomyReader(taxoDir); > > Does anybody have an idea, how to gather facet information? > > Thanks in advance, > > Ralf