2012-11-09 145 views
2

我正在使用结果分组进入SOLR。我如何获得结果总数?结果我的意思是分组数据的数量。SOLR - 结果分组结果的计数

例如:

enter image description here

我搜索与2个电子邮件地址( “[email protected]” OR “[email protected]”)。我在结果集中得到了2个结果。结果节点中有numFound属性,它显示匹配16次的电子邮件地址“[email protected]”和匹配28次的电子邮件地址“[email protected]”。有匹配属性显示匹配总数(16 + 28 = 44)。但是我想知道结果集的总数是2(1代表“[email protected]”+ 1代表“[email protected]”)。我怎么能得到这个?

回答

6

对于组数使用groups.ngroups请求参数,它会给你组计数。

Documentation: -

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

伟大的!有效 :) –