Search code examples
web-applicationssearchfiltersearch-engine

How to implement 'saved search' functionality for high traffic webapp?


I was wondering about the functionality of 'saved search' that one can find on the big webapps like eBay. What you can do there is to save the search (e.g. "pentax lens 50mm 1.4") and every time somebody puts for sale a new prime standard fast pentax lens that matches that search criteria you get notified.

To me implementation of such functionality is not trivial exercise especially if you have hundreds of thousands saved searches and tens of new items being put on sale each minute.

Can anyone shed some light, what sort of clever technique one should use here to get the reasonably efficient implementation that scales well for high traffic webapps?


Solution

  • You could implement it with a reverse search. For example, create an index of all the saved searches and each time a new item goes on sale look up matching queries based on the terms in the item.

    I wrote psearch, a python implementation of a reverse search that could be used to implement this. It could handle a few hundred thousand queries and tens of items a minute easily on a single server.