* Allowing VariantQuery for Feed Generation Apologies for the breadth of this pull request, I had considered many small commits, but felt that would've been more effort for the value provided. This commit includes the following: - Documentation updates to the feed variant (though not the final pass) - Renaming and adding RelevancyLevers that help differentiate - Adding RelevancyLever#range to provide documentation - Reducing redundent controller logic by making a `Articles::Feeds.feed_for` method. - Adding some configuration validation for RelevancyLevers - Adding constants for better clarification - Testing unhappy paths for feed configuration - Adjusting the module namespace of some objects - Exposing top-level configurations for variants (along with their defaults) - Creating the VariantyQuery that at present inherits from the `Articles::Feeds::WeightedQueryStrategy` As implemented, we can deploy this code to production without using the new VariantQuery. Once we toggle on the `:feed_uses_variant_query_feature` FeatureFlag, it will switch to using the VariantQuery. The VariantQuery's two variants and the internal configuration of `Articles::Feeds::WeightedQueryStrategy` produce the same query. The goal of this factor is to allow for a quick on and off toggle of the feed query; to ensure that what we introduce remains performant. - Closes forem/forem#17272 - Closes forem/forem#17276 - Closes forem/forem#17216 In addition, I will be recording a code-walkthrough and linking that recording to the pull request. * Apply suggestions from code review Co-authored-by: Mac Siri <krairit.siri@gmail.com> Co-authored-by: Mac Siri <krairit.siri@gmail.com>
102 lines
1.9 KiB
JSON
102 lines
1.9 KiB
JSON
{
|
|
"max_days_since_published": 15,
|
|
"order_by": "relevancy_score_and_publication_date",
|
|
"levers": {
|
|
"daily_decay": {
|
|
"cases": [
|
|
[0, 1],
|
|
[1, 0.99],
|
|
[2, 0.985],
|
|
[3, 0.98],
|
|
[4, 0.975],
|
|
[5, 0.97],
|
|
[6, 0.965],
|
|
[7, 0.96],
|
|
[8, 0.955],
|
|
[9, 0.95],
|
|
[10, 0.945],
|
|
[11, 0.94],
|
|
[12, 0.935],
|
|
[13, 0.93],
|
|
[14, 0.925]
|
|
],
|
|
"fallback": 0.9
|
|
},
|
|
"comments_count_by_those_followed": {
|
|
"cases": [
|
|
[0, 0.95],
|
|
[1, 0.98],
|
|
[2, 0.99]
|
|
],
|
|
"fallback": 0.93
|
|
},
|
|
"comments_count": {
|
|
"cases": [
|
|
[0, 0.8],
|
|
[1, 0.82],
|
|
[2, 0.84],
|
|
[3, 0.86],
|
|
[4, 0.88],
|
|
[5, 0.9],
|
|
[6, 0.92],
|
|
[7, 0.94],
|
|
[8, 0.96],
|
|
[9, 0.98]
|
|
],
|
|
"fallback": 1
|
|
},
|
|
"featured_article": { "cases": [[1, 1]], "fallback": 0.85 },
|
|
"following_author": {
|
|
"cases": [
|
|
[0, 0.8],
|
|
[1, 1]
|
|
],
|
|
"fallback": 1
|
|
},
|
|
"following_org": {
|
|
"cases": [
|
|
[0, 0.95],
|
|
[1, 1]
|
|
],
|
|
"fallback": 1
|
|
},
|
|
"latest_comment": {
|
|
"cases": [
|
|
[0, 1],
|
|
[1, 0.9988]
|
|
],
|
|
"fallback": 0.988
|
|
},
|
|
"matching_positive_tags_intersection_points": {
|
|
"cases": [
|
|
[0, 0.7],
|
|
[1, 0.7303],
|
|
[2, 0.7606],
|
|
[3, 0.7909],
|
|
[4, 0.8212],
|
|
[5, 0.8515],
|
|
[6, 0.8818],
|
|
[7, 0.9121],
|
|
[8, 0.9424],
|
|
[9, 0.9727]
|
|
],
|
|
"fallback": 1
|
|
},
|
|
"privileged_user_reaction": {
|
|
"cases": [
|
|
[-1, 0.2],
|
|
[1, 1]
|
|
],
|
|
"fallback": 0.95
|
|
},
|
|
"public_reactions": {
|
|
"cases": [
|
|
[0, 0.9988],
|
|
[1, 0.9988],
|
|
[2, 0.9988],
|
|
[3, 0.9988]
|
|
],
|
|
"fallback": 1
|
|
}
|
|
}
|
|
}
|