与 Riak 一起链接行走 - 搜索“共同的朋友”;
任何熟悉 Riak 的人都可以解释一下如何进行链接遍历来找到两个人之间的共同好友(例如,就像 Facebook 的共同好友一样)?此外,理想情况下,计算要求应该是最小的 - 即。服务器不必花费很长的时间进行计算。
我正在考虑将所有“人”放入“人”桶中,每个“人”都会有一个朋友链接(这就像一对多关系),然后对于每个“人”来说都是相反的关系-链接回另一个人(这就像一对一的关系)。我认为可以有效地做到这一点,并且计算/结果将立即可用,但只是无法弄清楚。
(好吧,我还没有完全开始使用 Riak 进行实际编码,所以对 Riak 的链接行走功能有更全面的解释将不胜感激。)
谢谢!
Can anyone familier with Riak explain how to do a link-walk to find common friends among two people (eg. just like Facebook's common friends)? Also, the computation requirement should ideally be minimal - ie. the server does not have to go through great length do do calculations.
I'm thinking of putting all 'persons' in a "people" bucket, and each 'person' will have a friends link (this is like a one-to-many relationship), then for each 'person' is reversed relationship-linked back to the other person (this is like a one-to-one relationship). I think it is possible to do this efficiently and calculation/result will be instantly available, but just can't figure it out.
(Alright, I have not exactly started real-coding with Riak, so a more thorough explanation on Riak's link walking feature would be appreciated.)
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我看到两种可能的解决方案:
I see two possible solutions: