【发布时间】:2017-05-10 18:02:10
【问题描述】:
我使用 solr 4.3.0,我需要从每个组的最小值进行排序(asc/desc)。
我使用下面的查询来实现 group.sort 基于价格如下,
查询:group.field=id&group.ngroups=true&group.sort=price_USD+asc&group=true&group.facet=true&group.limit=1 结果:
{
"grouped": {
"category": {
"matches": 9,
"groups": [
{
"groupValue": "11121",
"doclist": {
"numFound": 3,
"start": 0,
"docs": [
{
"id": "233",
"catentry_id": "ProductBean",
"price_USD": 24,
"category": "11121",
"version": 1566834290000396300
}
]
}
},
{
"groupValue": "111",
"doclist": {
"numFound": 3,
"start": 0,
"docs": [
{
"id": "2",
"catentry_id": "ProductBean",
"price_USD": 24,
"category": "111",
"version": 1566833543360807000
}
]
}
},
{
"groupValue": "11112",
"doclist": {
"numFound": 3,
"start": 0,
"docs": [
{
"id": "22",
"catentry_id": "ProductBean",
"price_USD": 22,
"category": "11112",
"version": 1566833809098276900
}
]
}
}
]
}
}
}
但是对查询应用排序并没有按预期工作,因为它正在考虑来自每个组的所有值不限于每个组的最小值。
请帮我解决这个问题
【问题讨论】:
标签: solr