0

Is there any way to get the number of distinct groups in a distributed grouping in solr?

The ngroups param returns the summatory of all groups. If a group exists in more than one shard I will have repeated this groups in the ngroups.

Yago Riveiro
  • 727
  • 13
  • 28

2 Answers2

1

Check SOLR-3316 and SOLR-3436.
May be an existing issue which is fixed.

Jayendra
  • 52,349
  • 4
  • 80
  • 90
  • I send a email to Martijn van Groningen (the author of patch for issue SOLR-3316) and he confirmed me that the result of ngroup is in fact the sum of all groups and not the distinct groups. Unfortunately, there isn't any funcionality that do that I want. – Yago Riveiro Sep 13 '12 at 16:42
0

There are a few solutions to this now:

http://yonik.com/solr-count-distinct/

You can use the stats component with pivot faceting, use group with group.facet or use the new analytics API that shipped in 5.2 (5.1. didn't seem to work when I tried it).

Simon
  • 2,840
  • 2
  • 18
  • 26