-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Fix follow recommendation biased towards older accounts #17126
Fix follow recommendation biased towards older accounts #17126
Conversation
class UpdateAccountSummariesToVersion2 < ActiveRecord::Migration[6.1] | ||
def up | ||
reapplication_follow_recommendations_v2 do | ||
drop_view :account_summaries, materialized: true | ||
create_view :account_summaries, version: 2, materialized: { no_data: true } | ||
safety_assured { add_index :account_summaries, :account_id, unique: true } | ||
end | ||
end | ||
|
||
def down | ||
reapplication_follow_recommendations_v2 do | ||
drop_view :account_summaries, materialized: true | ||
create_view :account_summaries, version: 1, materialized: { no_data: true } | ||
safety_assured { add_index :account_summaries, :account_id, unique: true } | ||
end | ||
end | ||
|
||
def reapplication_follow_recommendations_v2 | ||
drop_view :follow_recommendations, materialized: true | ||
yield | ||
create_view :follow_recommendations, version: 2, materialized: { no_data: true } | ||
safety_assured { add_index :follow_recommendations, :account_id, unique: true } | ||
end | ||
end |
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 wonder if, instead of the reapplication_follow_recommendations_v2
thing, you can use replace_view
instead? Since the columns are exactly the same in the same order, I think this should work.
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.
Actually, no this is not possible. This is only possible for non-materialized views.
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'm looking forward to scenic's update_view reducing this verbose description, but not yet.
scenic-views/scenic#218
Currently, the follow recommendations do not show the newly recognized accounts by the server, as the wrong refinement will preferentially select the old account ID. Fix this.
Also, since the boost is included when detecting the language used by the account from the status, the language detection fails in rare cases. Fix this.