Combing two queries for the same collection using different filters.

I'd like to create a "feed" for users that displays a combination of posts made by accounts they follow, as well as tags they follow. Similar to Instagram, an ideal result would be a feed where you can filter a query by who the post was created by (selecting only accounts who the user follows), mixed in with posts that contain a tag that the user follows (regardless of the account who posted it).

I'm not sure how I can run two queries on a page and then combine them in a "GridView" using the infinite scroll feature. I could run two separate queries and then combine them but I'm assuming that would mean the queries would need to grab ALL of the posts that match the filters, and then combine them which may be too much data being fetched all at once.

How can I run two separate queries, combine them, without fetching ALL of the data that matches the two separate queries?

(I'm using Firebase by the way)

10
1 reply