gorse-io / gorse-io/gorse

[Feature request] Option to pass exclude item IDs

Open
#1,345 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
9.8k
Forks
912
Avg merge
2h 35m
Merged PRs (30d)
9

Description

Currently my approach to avoid querying duplicated items.

**First**
```
This is be ran every time i called GetRecommend or fetch posts directly from database

for _, item := range postsResponses {
//Feedback is been sent immediately after each query to prevent fetching same posts on next query, the "read" will later be updated to "watched" when watched

postsFeedbacks = append(postsFeedbacks, gClient.Feedback{
FeedbackType: "read",
UserId: utilities.ToStr_fromInt(user_id),
ItemId: utilities.ToStr_fromInt(item.Data.ID),
Value: 0,
Timestamp: appInst.Util.Time.GetNow(),
})
}

if len(postsFeedbacks) != 0 {
appInst.Recommender.GorseClient.InsertFeedback(context.Background(), postsFeedbacks)
}
```
**Then secondly**
```
//Delete all "read" feedback upto an 30 minutes in database in task job
var feedbacks []RecommenderFeedback
db.Table("feedback").Select("user_id, item_id").Where("feedback_type = ? AND updated <= NOW() - INTERVAL ? MINUTE", "read", 30).Limit(10000).Scan(&feedbacks)
for _, f := range feedbacks {
self.instance.Task.Usecase.Session.App.Recommender.GorseClient.DeleteFeedback(context.Background(), "read", f.UserID, f.ItemID)
}
```

This approve is not that nice, better approach should be passing exclude item IDs too to GetRecommend api

Contributor guide

Open the contributing guide

Research direction

Start by tracing the GetRecommend API entry point and the recommendation flow it invokes; the issue does not name implementation files or tests. Clarify the request shape and exclusion semantics, then verify that recommendations never include the supplied item IDs and that existing behavior remains covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.