Skip to content

sort group hot recall items#171

Merged
bruceding merged 1 commit intomasterfrom
fix_group_hot_recall
Mar 2, 2026
Merged

sort group hot recall items#171
bruceding merged 1 commit intomasterfrom
fix_group_hot_recall

Conversation

@symphony09
Copy link
Collaborator

分组热门召回随机打散截断改为排序后截断

@symphony09 symphony09 requested a review from bruceding March 2, 2026 10:03
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review by ChatGPT

"sort"
"strings"
"sync"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

潜在Bug

  • 随机数种子缺失: 移除了math/rand包导入,但没有看到重新引入rand.Seed()的地方。如果代码中其他地方还使用了rand包,可能会导致随机数序列每次都相同,影响推荐结果的多样性。

建议

  • 如果需要随机功能,请确保在程序启动时调用rand.Seed(time.Now().UnixNano())来设置随机种子。


for _, id := range itemIds {
strs := strings.Split(id, ":")
if len(strs) == 1 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

功能变更分析

  • 推荐算法逻辑改变: 删除了原有的随机打乱前一半元素并截取recallCount个项目的逻辑,这改变了推荐结果的生成方式。

潜在问题

  • 推荐多样性降低: 原来的随机打乱逻辑是为了增加推荐多样性,现在删除后可能导致每次返回的结果完全一致,用户体验下降。
  • 算法意图不明确: 需要确认是否真的要移除随机化逻辑,如果是业务需求变更,需要确保相关方已知悉此变化。

@bruceding bruceding merged commit ea1fdd2 into master Mar 2, 2026
4 of 5 checks passed
@bruceding bruceding deleted the fix_group_hot_recall branch March 2, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants