Sudo START - Improving search algorithm for PleaseMatchMe

[caption id="attachment_6" align="aligncenter" width="344" caption="source: pleasematch.me"]

[/caption]

Alright. I decided I need to do a better job blogging. I wrote this post originally on Posterous, but got my own domain today and just installed WordPress.

So for my first post back in the blogosphere I want to announce to the world my excitement at achieving faster search results on PleaseMatchMe - a site I built with my friends Ajay Mehta and Tess Rinearson.

So, we had recently made our home page a simple 'search for your school' page instead of the sample game we originally started. We found this gave us a significantly lower bounce rate and kept people on our site. But our schools database was increasing and causing slow times to load. We wanted to be able to show the search-er the count of people currently in that school that are play-able so that added an additional load as we queried for live results for people in that school.

Here's what (genius, web-entrepreneur, programmer, and now-friend) Dan Shipper help me figure out:

  • I could use the 'LIKE' feature in my MySQL query to only get the best matching data from my dataset rather than loading all schools, and using a substring match in php.
  • I could keep track of the count of students for each school in my database and simply upgrade that number with each new user

Those two things SIGNIFICANTLY decreased search-time for our site. Though still some issues I need to work out. Currently I am running a python script to update the count every hour or so, when I need to be doing it real time by updating the count per a user. Last night, though, I couldn't get the intval function (returns integer value of an object) working in php and updating counts was failing. I had homework and had to stop and just use the python script for now.

Updates later.