我正在对 solr 进行构面查询。这给了我构面及其每个项目的计数...但是现在我想对构面执行组查询。这使我根据组进行计数...
例子
下面是数据
Item1:耐克鞋(尺码:8,9,10) Item2:锐步鞋(尺码:8,9,10)
现在在这种情况下,我的品牌方面查询返回结果如下
耐克:3
锐步:3
我需要的结果是
- 耐克:1
- 锐步:1
问候
我正在对 solr 进行构面查询。这给了我构面及其每个项目的计数...但是现在我想对构面执行组查询。这使我根据组进行计数...
下面是数据
Item1:耐克鞋(尺码:8,9,10) Item2:锐步鞋(尺码:8,9,10)
现在在这种情况下,我的品牌方面查询返回结果如下
耐克:3
锐步:3
我需要的结果是
问候
您是否按照此处的说明启用了 group.facet=true 。你至少需要 3.3
注意:&group=true&group.field=displayterm
此响应按 displayterm 分组
回复 :
{
"responseHeader":{
"status":0,
"QTime":6,
"params":{
"fl":"displayterm",
"indent":"true",
"q":"displayterm:new",
"q.op":"and",
"group.field":"displayterm",
"group":"true",
"wt":"json"}},
"grouped":{
"displayterm":{
"matches":231,
"groups":[{
"groupValue":null,
"doclist":{"numFound":220,"start":0,"docs":[
{
"displayterm":"Professional News"}]
}},
{
"groupValue":"general",
"doclist":{"numFound":1,"start":0,"docs":[
{
"displayterm":"General News"}]
}},
{
"groupValue":"delhi",
"doclist":{"numFound":2,"start":0,"docs":[
{
"displayterm":"New Delhi"}]
}},
{
"groupValue":"care",
"doclist":{"numFound":1,"start":0,"docs":[
{
"displayterm":"New Born Care Week"}]
}},
{
"groupValue":"civil",
"doclist":{"numFound":1,"start":0,"docs":[
{
"displayterm":"NEW CIVIL HOSPITAL, SURAT"}]
}},
{
"groupValue":"blood",
"doclist":{"numFound":1,"start":0,"docs":[
{
"displayterm":"Newlife Blood Bank"}]
}},
{
"groupValue":"college",
"doclist":{"numFound":1,"start":0,"docs":[
{
"displayterm":"New Medical College Hospital"}]
}},
{
"groupValue":"degree",
"doclist":{"numFound":1,"start":0,"docs":[
{
"displayterm":"Homeopathy(Degree Course) Regulation New"}]
}},
{
"groupValue":"child",
"doclist":{"numFound":1,"start":0,"docs":[
{
"displayterm":"Reproductive, Maternal, Newborn, Child and Adolescent Health"}]
}},
{
"groupValue":"foundation",
"doclist":{"numFound":1,"start":0,"docs":[
{
"displayterm":"The new century Medical and Educational foundation malegaon, Nashik"}]
}}]}}}