Adil Malik
Adil Malik

Reputation: 6357

SOLR - Count of results from Result Grouping

I am using Result Grouping into the SOLR. How can i get the total number of results? By result I mean the count of grouped data.

For example:

enter image description here

I searched with 2 email addresses ("[email protected]" OR "[email protected]"). I got 2 results in the result set. There is numFound attribute in the result node which shows the email address "[email protected]" matched 16 times and the email address "[email protected]" matched 28 times. There is a matches attribute which shows the total number of matches (16 + 28 = 44). But i want to know the total number of result set which is 2 (1 for "[email protected]" + 1 for "[email protected]"). How can i get that?

Upvotes: 2

Views: 2914

Answers (1)

Jayendra
Jayendra

Reputation: 52779

For the number of groups use the groups.ngroups request parameter which will give you the group count.

Documentation :-

group.ngroups
true/false
If true, includes the number of groups that have matched the query. Default is false.

Upvotes: 7

Related Questions