如何设计推荐页面
我有一个允许用户听音乐的应用程序。每个艺术家都有适合他/她自己的特定流派。这些歌曲没有流派。
我需要一个基于用户不时查看的歌曲类型的推荐页面。
考虑这个例子。
我有: 用户乔 艺术家本.有原声流派。有1首歌。 艺术家亚历克斯.有爵士乐流派,有 1 首歌曲。 艺术家汉娜.有原声流派。有1首歌。
用户 Joe 听了 Alex 的歌曲两次,听了 Ben 的歌曲 3 次。在推荐页面中,应该显示 Ben 和 Hannah。因为乔更喜欢听声音媒体。
我应该如何着手设计这个?我应该有一个表来跟踪这些数据吗?如果是这样,应该存在哪些列?
或者,我应该在加载推荐页面时进行某种聚合吗?
Ive got an app that allows users to listen to music. Each artist has a specific genre set for him/herself. The songs don't have genres.
I need a recommendation page based on what song genre the user looks at from time to time.
Consider this example.
Ive got:
User Joe
Artist Ben. Has genre acoustic. Has 1 song.
Artist Alex. Has genre jazz, has 1 song.
Artist Hannah. Has genre acoustic. Has 1 song.
User Joe listens to Alex's song twice and listens to Ben's song 3 times. In the recommendation page, it should show Ben and Hannah. Since Joe likes listening to acoustic media more.
How should I go about designing this? Should I have a table that keeps track this data? If so, what columns should exist?
Or, should I do some kind of aggregation when the recommendation page is loaded instead?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要通过歌曲和用户之间的 has_many 连接。除了 user_id 和 Song_id 之外,此连接还有一个收听计数器。然后,您可以找到与单个用户听过相同歌曲的用户,返回这些用户听得最多的歌曲,并按具有相同流派的用户先排序,然后再排序不同流派的用户。
You need a has_many through join between songs and users. This join would in addition to the user_id and song_id have a listens counter. Then you can find users who have listened to the same songs as the individual user, return the songs those users have listened to most and ordered by those users first who have the same genre then those who do not.