Aggregating MoreLikeThis Results in RavenDB

情到浓时终转凉″ 提交于 2019-12-24 15:44:55

问题


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.

But what I would like to do is order by the number of matches of 3 separate fields added together.

An example record would be:

var data = new Data{ 
     backyardigans = "Pablo Tasha Uniqua Tyrone Austin",
     engines = "Thomas Percy Henry Toby",
     pigs = "Daddy Peppa George Mummy Granny"
}; 

If another document matched 1 backyardigan 2 engines and 1 pig it would get a score of 4

If another document matched 2 backyardigans 4 engines and 0 pigs it would get a score of 6

These aggregated scores would be the field we would order the results by so they would come back 6,4 and so on.

Is there a way to achieve this with the MoreLikeThis bundle please?


回答1:


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.

Note that this is also a limitation in the underlying Lucene implementation, so there isn't much we can do about it.



来源:https://stackoverflow.com/questions/9812423/aggregating-morelikethis-results-in-ravendb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!