Wednesday, April 2, 2008

Google Custom Search Engine (Business Edition)

Part 1: The Set Up
We decided to use google's custom search engine to do the search for our "similar questions" feature and for our regular search feature a while back. Fulltext search just wasn't cutting it. Who does better search than google right?

I finally got around implementing it last week.
It was a fairly painless process:
  1. sign up and pay (Wayne took care of this part)
  2. grab the URL from the admin panel page.
    the URL is only available to the admin or the person who paid.
    adding me as a contributor didn't work and you can't add any additional admins.
  3. read the doc. this took me a while to find for some reason:
    http://www.google.com/coop/docs/cse/resultsxml.html
    it seems the doc for the google application is similar but NOT the same as there are more functions that can be used (like meta data filtering) in the application.
  4. stick the URL in my existing search object, in a new function:
    1. send queries to google
    2. get xml back
    3. parse and style xml
    4. display results
It returns pretty good results, comparing to the old fulltext search.
There was a lag time of about 24-48 hours (this still needs more testing, but that's the general consensus on the interweb). New questions do not come up in the results. That's ok though because the older questions usually have more answers. Who wants to look at questions with no answers?

Everything was peachy then I get one text early next morning from Wayne telling me there are "mad bugs". uh oh.

to be continued...

No comments: