Hi, I need a little help with someting I’d like to implement, but not sure how to do it.
I’m running eBay like classifieds site. There are a lot of filters on my site e.g. you can filter ads by price, by category, by city, by condition…
Let’s say we have this use case:
- User is able to filter ads on my site using filters
- Once he does it he can save those filters and subscribe to get push notification when someone submits an ad that matches those filters
- I save those filters in my database for that user
- For this example let’s say my site has around 100k active subscriptions.
The first step is obviously to attack a place in a code where ad is being saved to the database. I’m having a problem with how to know if that specific ad matches those filters.
I would need to go through 100k subscriptions and their filters to know which filter matches the ad that has been posted. It doesn’t sound too good for me, it could be 1M filters or more.
Can someone help me with that or at least point me to the right direction.
This is basic version.
Filters:
- country, county, city
- min price, max price
- condition (new,old…)
- ads with/without picture
User A subscribed to set of filters:
- England, London
- Min price: 200 €
- X
- X
User B subscribed to set of filters:
- England
- Max Price: 500€
- New
- X
User C subscribed to set of filters:
- Germany
- Min price: 200 €
- X
- With pictures
User X submitted ad with following data:
- City: London
- Price: 300 €
- Condition: New
In this case User A and User B need to get push notification because ad matches their filters.