我有一个solr文档结构
[
{
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
}简单地说,我需要多值字段上的组计数。
请帮我弄一下这个。
谢谢。
发布于 2016-01-29 02:32:54
试试这个:
?q=*:*&facet=true&facet.field=category确保多值字段已编入索引。
https://stackoverflow.com/questions/35064624
复制相似问题