Maybe pivot facets will do what you need? See: https://cwiki.apache.org/confluence/display/solr/Faceting#Faceting-Pivot(DecisionTree)Faceting
Best, Erick On Mon, Feb 23, 2015 at 11:31 AM, Vishal Swaroop <vishal....@gmail.com> wrote: > Please suggest on how to get the distinct count for a field (name). > > Summary : I have data indexed in the following format > category name value > Cat1 A 1 > Cat1 A 2 > Cat1 B 3 > Cat1 B 4 > > I tried getting the distinct "name" count... but it returns 4 records > instaed of 2 (i.e. A, B) > http://localhost:8081/solr/core_test/select?q=category:Cat1&fl=category,name&wt=json&indent=true&facet.mincount=1&facet=true > > In Oracle I can easily perform the distinct count using groop-by > select c.cat, count(*distinct *i.name) from category c, itemname i, value v > where v.item_id = i.id and i.cat_id = c.id and c.cat ='Cat1' *group by > c.cat <http://c.cat>* > Result: > "Cat1" "2" > > Thanks