2012-11-09 141 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

偉大的!有效 :) –