[英]solr: group by multi valued field
我有一個solr doc結構
[
{
category:{mobiles},
name: iphone,
store: chroma,
discount: 10%
},
{
category:{mobiles,laptops},
name: Apple,
store: Reliance Digitals,
discount: 12%
},{
category:{electornics},
name: Boss,
store: chroma,
discount: 5%
},{
category:{headphones,mobiles},
name: Samsung,
store: Universal,
discount: 8%
},{
category:{headphones},
name: HTC,
store: Chroma,
discount: 50%
},
]
我需要一個帶有響應的solr查詢
{
headphones: 2
mobiles: 3
laptops: 1
electornics: 1
}
簡單地說,我需要對多值字段進行分組計數。
請幫我解決一下這個。
謝謝。
嘗試這個:
?q=*:*&facet=true&facet.field=category
確保索引多值字段。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.