-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
自定义排序方面的问题想请教一下 #110
Comments
可以使用sql模版实现自定义计算后的字段orderby排序的逻辑,但不建议这么做,不命中索引的sql语句执行是非常慢的,建议脚本计算下积分再入库根据积分进行排序 |
但是积分是随着浏览、点赞、收藏变动而变动的,如果把积分加到字段的话,每当“浏览、点赞、收藏”变动时,都要把积分也更新一下,感觉很麻烦。 |
|
@3DMXM |
好的,谢谢 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
事情是这样的,我自定了一套积分算法:
积分 = 浏览/2 + 点赞 + 收藏*2
然后我想让热门内容按照积分从高到低进行排序
“积分”这个没有在数据库存为字段,如果要在数据库加的话要刷10多万条数据,感觉蛮麻烦的;
如果:
浏览是“click”
点赞是“mark”
收藏是“collection”
积分存为“integral”
请问要怎么写才能让内容按照积分从高到低进行排序
The text was updated successfully, but these errors were encountered: