I'm looking to implement a personalized "For You" list that displays items from my database tailored to user preferences. Specifically, I want the list to prioritize and show items that match a user's set of interests (categories), followed by other general items. Here's how the data is structured:
Each user in the
users
collection has acategories
field, which is a list of strings representing their interests.Each item in the
items
collection also has acategories
field, containing strings that categorize the item.
I would like the ListView to display:
Items matching the user's categories (the number of matches could be zero if the user hasn't selected any preferences).
All other items from the database, after the items that match the user's categories
since there's no way to order the query like that i was thinking to have 2 lists and display them one after the other, but while there is a way to filter by categories:
i couldn't find any way to filter the query by excluding the categories
any advice will be much appreciated