Skip to content

[Feature request] Option to pass exclude item IDs #1345

Description

@generalomosco

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions