I am in the process of developing a website that involves pagination and filtering specific data.
if (eventType) query = query.where('general.eventType', '==', eventType);
if (price) query = query.where('general.eventTicketPrice', price == "free" ? '==' : '>=', 0);
if (startDate) query = query.where('general.eventDates.start', '>=', new Date(startDate));
if (endDate) query = query.where('general.eventDates.start', '<=', new Date(endDate));
if (location) query = query.where('general.location.city', '==', location);
if (participation) query = query.where('general.locationType', '==', participation);
...
...
Including about 20 different filters, each filter selection requires me to generate a new index in firebase. It seems like I will have to create an index for every possible combination of filters. To make this process more efficient, I created a tool that automatically generates the necessary queries and provides me with the URL for creating the index, but there are a vast number of combinations to sift through.
Is there a solution to streamline this issue?
I considered retrieving all documents and manually applying the filters. While this method is straightforward to implement, it may result in higher costs and increased latency. Although currently my dataset is relatively small, I anticipate needing to interrogate hundreds, if not thousands, of documents in the future.
What recommendations do you have for resolving this challenge effectively?