Solr 分组的替代基于分数的排序
目前,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 。
Currently, solr grouping (http://wiki.apache.org/solr/FieldCollapsing) sorts groups "by the score of the top document within each group". E.g.
[...]
"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}]
}},
[...]
Is there an out-of-the-box way to instead sort groups by the sum of the scores of the documents within each group? E.g.
[...]
"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}]
}},
[...]
With the release of sorting by Function Query (https://issues.apache.org/jira/browse/SOLR-1297), it seems that there should be a way to use the sum() function (http://wiki.apache.org/solr/FunctionQuery). But it's not quite close enough since the "score" field is not part of the documents.
I feel like I'm close but I'm missing some obvious piece. I'm using Solr 3.5 .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来这个问题已经有一段时间了: https://issues.apache.org /jira/browse/SOLR-2072 。这正是我所说的。我必须跟进 Solr 人员。
Looks like this has been an open issue for a while: https://issues.apache.org/jira/browse/SOLR-2072 . This is exactly what I was talking about. I'll have to follow up with the Solr folks.