Hi, Some questions about an integer with numFacetFound for facets in solr:
Our application "tecfinder" has a faceted browsing with paging for each facet (see "Fachgebiete" in http://tecfinder.fiz-technik.de/tecfinder/faces/facelets/search/search.jsp?query=Laser ). Currently I am integrating solr in "tecfinder". So I need the number of terms that have a non zero count. e.g. if I search with facet=true&facet.field=LG&f.LG.facet.limit=4 we need something like numFacetFound=19 for field LG (see example below). To program an addition for SimpleFacets should be easy, because I only have to change three methods: - getFacetTermEnumCounts (with respect to the line "if (--lim<0) break;") - getFieldCacheCounts (count non zero values of "int[] counts") - UnInvertedField.getCounts (again "int[] counts") It will not be easy to change DistribFieldFacet, but I hope this can wait ("This API is experimental and subject to change"). So my questions: Is there already an "numFacetFound" addition programed for solr? Did I miss something? Is there more to change then this three methods? What is an accurate place to expand the response with "numFacetFound"? (Should I derive a subclass "SubList" or "OffsetList" of NamedList with an attribute "totalAmount"). Any advice is welcome Karsten p.s. the example for facet=true&facet.field=LG&f.LG.facet.limit=4 <result name="response" numFound="18614" start="0"> <lst name="facet_counts"> <lst name="facet_queries"/> <lst name="facet_fields"> <lst name="LG"> <int name="_numFacetFound">19</int> <int name="ru">592</int> <int name="fr">191</int> <int name="ja">82</int> <int name="pl">32</int> </lst> </lst> <lst name="facet_dates"/> </lst> </response> hossman wrote: > > > : > : how I can get count of distinct facet_fields ? > : > : > : > : like numFacetFound in this example: > : > > : > There's currently no way to do that. > > : I need to do the same thing. Any pointers on how one would go about > : implementing that? (in Java) Thanks. > > The change would be in the SimpleFacets class, and there are a couple of > differnet code paths to worry about (because two different hueristics are > used depending on the field type) but the first step would be to define > what the count represents: is it just the number of terms being returned? > the number of terms that have a non zero count? or all of the terms in the > field? > > the first and the last are pretty trivial, the middle one requires > maintaining a new count as the terms are scanned (and if i'm not mistaken, > there's an optimization in there to stop once we know we won't find any > terms better then theones we already have, and in order to return that > count you'd need to prevent that optimization) > > > -Hoss > > > -- View this message in context: http://www.nabble.com/Count-of-facet-count-tp16678811p24052214.html Sent from the Solr - User mailing list archive at Nabble.com.