-
Notifications
You must be signed in to change notification settings - Fork 15
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
Feature/video relevance #120
Feature/video relevance #120
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a question about the weights used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
em | ||
) | ||
await em.query(` | ||
UPDATE "video" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The query looks correct, I have double checked it using chatgpt too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a brief look at the PR and here I some general remarks I have:
- The PR is targetting
orion-v2
, but this is a stale branch. Since the production release of Orion v2, all the latest work is already onmaster
, so please retarget your PR tomaster
. I think we can even deleteorion-v2
at this point to prevent confusion. - I don't think that storing the relevance score and trying to recalculate it every time some action can affect it (even if there's a "delay", like "only recalculate if
views_count
changes by at leastX
") is a good approach as opposed to extending queries using custom resolvers. It should be pretty cheap to calculate the relevance score since there are alreadycomments_count
,reactions_count
andviews_num
columns insidevideo
table which are kept up to date, so you don't even need to do subqueries/joins with reactions/comments/views tables in order to do that, it would just be a pretty simple formula using columns already available invideo
. So to clarify what I mean exactly: Instead of storing relevance score as a separate column, you could augment/create a custom query likemostViewedVideosConnection
that would support ordering by relevance score and the formula for calculating the relevance score could just be part of theSELECT
orORDER BY
statement, ie.SELECT (video.views_num * views_weight + video.comments_count * comments_weight ...) as relevance
, what do you think? Do you see any clear downside of this approach taking into account your desired use-case?
How inefficient is it to keep this solution over a custom query that calculates it on the fly? When we first talked about this |
I don't think it's very inefficient, my main issue is that it's complex and more prone to errors I think. |
5642352
to
c5a9882
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM
* Introduce new video property and scheduler to update it * Adjust equation and change score to float * Schedule updates in required places * Add mutation to change video weights * Adjust env weights * Fix for newness weight on creation * CR fixes * CR fixes v2 * Update src/mappings/content/video.ts * Update src/mappings/content/video.ts --------- Co-authored-by: Leszek Wiesner <leszek@jsgenesis.com>
* Introduce new video property and scheduler to update it * Adjust equation and change score to float * Schedule updates in required places * Add mutation to change video weights * Adjust env weights * Fix for newness weight on creation * CR fixes * CR fixes v2 * Update src/mappings/content/video.ts * Update src/mappings/content/video.ts --------- Co-authored-by: Leszek Wiesner <leszek@jsgenesis.com>
Joystream/atlas#4071