群的SOLR计数

群的SOLR计数,solr,fieldcollapsing,Solr,Fieldcollapsing,http://localhost:8080/solr/select?q=(apposta apposta per)或(sue prime ore al)&group=true&group.field=grouping\u field&group.limit=5 此查询返回两组:第一组有1个文档,第二组有2个文档 作为回应,我看到了文档数(3),但没有组数。 如何获取组数。使用group.ngroups=true将组数包含在响应中 更多信息@ 文档- group.ngroups-真/假 如果为tr

http://localhost:8080/solr/select?q=(apposta apposta per)或(sue prime ore al)&group=true&group.field=grouping\u field&group.limit=5

此查询返回两组:第一组有1个文档,第二组有2个文档

作为回应,我看到了文档数(3),但没有组数。
如何获取组数。

使用
group.ngroups=true
将组数包含在响应中

更多信息@

文档-
group.ngroups-真/假

如果为true,则包括与查询匹配的组数。默认值为false。

以上答案的一条注释100%正确,但有额外条件

您可以拥有:


group.main=>'true'

使用group.main=true时,是否有其他替代解决方案可以获取组计数?这是我获取组计数时所做的操作,但同时使用
group.main=true
。我给索尔打了两个电话。第一次调用将有
group.ngroups=true&rows=0
。这样,我们不获取任何数据,只获取计数。第二个调用将具有'group.main=true'。希望这对别人有帮助。