【发布时间】:2012-07-29 04:31:36
【问题描述】:
我正在对 solr 进行构面查询。它为我提供了构面及其每个项目的计数...但是现在我想对构面执行组查询。这使我根据组进行计数...
示例
以下是数据
Item1:耐克鞋(尺码:8,9,10) Item2 : Reebok 鞋款(尺码:8,9,10)
现在在这种情况下,我的品牌方面查询返回如下结果
耐克:3
锐步:3
我需要的结果是
- 耐克:1
- 锐步:1
问候
【问题讨论】:
标签: solr
我正在对 solr 进行构面查询。它为我提供了构面及其每个项目的计数...但是现在我想对构面执行组查询。这使我根据组进行计数...
以下是数据
Item1:耐克鞋(尺码:8,9,10) Item2 : Reebok 鞋款(尺码:8,9,10)
现在在这种情况下,我的品牌方面查询返回如下结果
耐克:3
锐步:3
我需要的结果是
问候
【问题讨论】:
标签: solr
注意:&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"}]
}}]}}}
【讨论】:
您是否按照here 的说明启用了 group.facet=true。您至少需要 3.3
【讨论】: