Hi Tim, Thanks for your reply. The index structure in my original post is just an example. We do have many free text fields with different analyzers.
I checked your post "Distinct terms in facet field", but I think the issues we try to address are different. Yours is to get distinct terms in the facet field, but what I want is to count the distinct values on the non-facet field. Since the facet results are much smaller than the query result, you could get all the facets and count by yourself. But in my case, if I count by myself, I have to get all the query results, and then count on distinct family_id for each facet value. Thanks. Qingdi Harsch, Timothy J. (ARC-SC)[LOCKHEED MARTIN SPACE OPNS] wrote: > > I began a similar thread under the subject "Distinct terms in facet > field". > > One thing I noticed though is that your fields seem to have a lot of > controlled values, or lack free text. Are you sure SOLR is what you > should be using? Perhaps a traditional RDB would be better and then you > would have "GROUP BY" and aggregate functions at your disposal... > > HTH, > Tim > > -----Original Message----- > From: Qingdi [mailto:liuqin...@yahoo.com] > Sent: Tuesday, April 28, 2009 1:07 PM > To: solr-user@lucene.apache.org > Subject: facet with group by (or field collapsing) > > > Hi, > > Is it possible to group the search result on certain field and then do > facet > counting? > > For example, the index is defined with the following fields: > Kid_Id, Family_Id, Age, School, Favorite_Sports (MultiValue Field) > > We want to query with Age between 10 yrs to 12 yrs and School in > (School_A, > School_B), and do faceting on Favorite_Sports. But instead of showing the > count of kids for each sport, we want to show the count of Families. > > Each family can have multiple kids. How to group the search result on > Family_Id, and then do faceting on Favorite_Sports? > > Appreciate your help. > > Qingdi > > > -- > View this message in context: > http://www.nabble.com/facet-with-group-by-%28or-field-collapsing%29-tp23285038p23285038.html > Sent from the Solr - User mailing list archive at Nabble.com. > > > -- View this message in context: http://www.nabble.com/facet-with-group-by-%28or-field-collapsing%29-tp23285038p23287434.html Sent from the Solr - User mailing list archive at Nabble.com.