Matching Specific Ad Based On Various Filters

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

Well, for starters, you have two distinct problems;

  1. How to filter.
  2. Scale of searching the filters.

How to filter is going to be a question that’s going to get turned back to you; what filters are you trying to implement, and how would you, as a human, decide if the ad matches your filters?

Start breaking it down like a computer would have to think.
Start with a simple problem statement.
“I want to be able to filter an ad based on the type of service that is being advertised.”
Then break it down:
How do you determine what type of service is being advertised?
What are the categories?
Does an ad have a category that it gets put into in the database, or do I need to try and guess the category?
(Hint: If your breakdown answers ever include the words ‘guess’, ‘assume’, ‘interpret’ or the like, you’re in dangerous waters and should reevaluate your strategy. It’s doable, but fallible.)

Thanks, but that didn’t help much. I already tried to search for some ideas and come up with my own solution, I failed so I decided to ask for help

Well, we don’t know what your ads are like. What information do you have about them? What information do you store? What’s the process for adding an ad?

You have walked into the mechanics shop and said “I have a vehicle, how do I make it do 200 mph?”

This is basic version.

Filters:

  1. country, county, city
  2. min price, max price
  3. condition (new,old…)
  4. ads with/without picture

User A subscribed to set of filters:

  1. England, London
  2. Min price: 200 €
  3. X
  4. X

User B subscribed to set of filters:

  1. England
  2. Max Price: 500€
  3. New
  4. X

User C subscribed to set of filters:

  1. Germany
  2. Min price: 200 €
  3. X
  4. 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.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.