Best approach for filtering favorites indexed items by user

Hi. Noob Algolia user here.

I have a legacy B2B application that implements Algolia indexes to allow searching “items” at light speed, where each item has a name, description, and some other attributes. We’re rendering 12 items per page of results. The total number of items is about 10.000.

Recently, the product team decided it was a good idea to allow registered users (a few thousand) to mark as favorite their own set of items so that each search can be done within the scope of their favorite items. We’re still supporting the more broad regular search.

My question for you would be… what do you think is the best approach to support this kind of search within the favorites scope?

I’ve been thinking about various approaches but so far I haven’t decided on a particular one. It’s like I can find pros and cons on each approach I can think of.

For example, given a user with ID 123, I considered assigning tags to items like “user123”, so that I can filter by such tags. The problem with that option is that those tags can’t be retrieved as part of the search results (as far as I know) and I would like to render some kind of favorite icon for each item that happens to be marked as favorite even from the broad search results page.

Another option could be to have a custom attribute where I store an array of “favorited by” user ids which I can also retrieve as part of search results (to later show the favorite icon if the custom attribute contains the user id), but I’m not sure what’s the best way to allow searching by these ids without generating noisy results (for example, I don’t want to mix results from “user12” with results from “user123”). Honestly, I’m not sure if that’s a valid concern, but I’d like to know your opinions.

I appreciate all the time you took reading my question. Thanks for your help!