目前,solr 分组(http://wiki.apache.org/solr/FieldCollapsing ) “按每个组中顶部文档的分数”对组进行排序。例如
[...]
"groups":[{
"groupValue":"81cb63020d0339adb019a924b2a9e0c2",
"doclist":{"numFound":9,"start":0,"maxScore":4.729042,"docs":[
{
"id":"7481df771afe39fab368ce19dfeeb528",
[...],
"score":4.729042},
{
"id":"c879e95b5f16343dad8b1248133727c2",
[...],
"score":4.6635237},
{
"id":"485b9aec90fd3ef381f013c51ab6a4df",
[...],
"score":4.347174}]
}},
[...]
是否有一种开箱即用的方法来代替按每个组中文档的分数总和对组进行排序?例如
[...]
"groups":[{
"groupValue":"81cb63020d0339adb019a924b2a9e0c2",
"doclist":{"numFound":9,"start":0,"scoreSum":13.739738,"docs":[
{
"id":"7481df771afe39fab368ce19dfeeb528",
[...],
"score":4.729042},
{
"id":"c879e95b5f16343dad8b1248133727c2",
[...],
"score":4.6635237},
{
"id":"485b9aec90fd3ef381f013c51ab6a4df",
[...],
"score":4.347174}]
}},
[...]
随着函数查询排序的发布(https://issues.apache.org/jira/browse/SOLR-1297),似乎应该有一种使用 sum() 函数的方法(http://wiki. apache.org/solr/FunctionQuery)。但它还不够接近,因为“分数”字段不是文档的一部分。
我觉得我很接近,但我错过了一些明显的部分。我正在使用 Solr 3.5 。