Added relevancy lever based on comments scores of an article (#18352)

This commit is contained in:
Josh Puetz 2022-08-19 11:06:13 -04:00 committed by GitHub
parent e358fdf347
commit 6297acbd5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -139,6 +139,20 @@ module Articles
select_fragment: "articles.comments_count",
group_by_fragment: "articles.comments_count")
relevancy_lever(:comments_score,
label: "Weight given based on sum of comment scores of an article.",
range: "[0..∞)",
user_required: false,
select_fragment: "SUM(
CASE
WHEN comments.score is null then 0
ELSE comments.score
END)",
joins_fragments: ["LEFT OUTER JOIN comments
ON comments.commentable_id = articles.id
AND comments.commentable_type = 'Article'
AND comments.deleted = false"])
relevancy_lever(:daily_decay,
label: "Weight given based on the relative age of the article",
range: "[0..∞)",
@ -311,6 +325,7 @@ module Articles
very_positive_reaction_threshold
positive_reaction_threshold
])
relevancy_lever(:public_reactions,
label: "Weight to give for the number of unicorn, heart, reading list reactions for article.",
range: "[0..∞)",