#1345·gorse

[Feature request] Option to pass exclude item IDs

Author: generalomoscoCreated Jul 19, 2026Updated Jul 20, 2026

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