聚合MoreLikeThis导致RavenDB [英] Aggregating MoreLikeThis Results in RavenDB
问题描述
我一直在尝试MoreLikeThis捆绑软件,以按照与关键文档相比在"backyardigans"字段中匹配项的数量来带回一组文档.这一切都按预期进行.
I have been trying out the MoreLikeThis Bundle to bring back a set of documents ordered by the number of matches in a field called 'backyardigans' compared to a key document. This all works as expected.
但是我想做的是按3个单独字段加在一起的匹配数进行排序.
But what I would like to do is order by the number of matches of 3 separate fields added together.
示例记录为:
var data = new Data{
backyardigans = "Pablo Tasha Uniqua Tyrone Austin",
engines = "Thomas Percy Henry Toby",
pigs = "Daddy Peppa George Mummy Granny"
};
如果另一个文档与1个backyardigan 2引擎和1头猪匹配,它将得到4分.
If another document matched 1 backyardigan 2 engines and 1 pig it would get a score of 4
如果另一个文档匹配了2个后院,4个引擎和0头猪,则得分为6
If another document matched 2 backyardigans 4 engines and 0 pigs it would get a score of 6
这些汇总分数将成为我们对结果进行排序的字段,以便它们返回6,4,依此类推.
These aggregated scores would be the field we would order the results by so they would come back 6,4 and so on.
是否可以使用MoreLikeThis捆绑包来实现这一目标?
Is there a way to achieve this with the MoreLikeThis bundle please?
推荐答案
这是不可能的,为此我们仅使用单个场频.
This isn't possible, we use only a single field frequency for this.
这很重要,因为我们需要按字段比较分数,并且如果不考虑每个字段的值,就不可能在全球范围内比较分数.
This is important because we need to compare the score on a field basis, and it isn't really possible to compare it on a global basis without taking into account the per fields values.
请注意,这也是底层Lucene实现的局限性,因此我们对此无能为力.
Note that this is also a limitation in the underlying Lucene implementation, so there isn't much we can do about it.
这篇关于聚合MoreLikeThis导致RavenDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!