Blog Pile

Dissecting the Code: Google Suggest

Found surfing RSS feeds of someone else’s del.icio.us tagged bag… If you’ve not come across the beta of Google’s new feature, take a peek at Google Suggest, which works like autocomplete by responding with common/popular search queries based on the first few letters you type in the search field.

What do you think? Dose of good, evil, or apathy?

Anyhow, Adam Stiles opened up the JavaScript scope to detail how this works..

Google’s Suggest feature is lighting up the blogosphere these days. It functions as like autocomplete for your search box, where Google attempts to determine what you are searching for and gives you suggestions. Web tinkerer that I am, I had to dig in a little and see how this works.

At its simplest, Google Suggest is javascript code that looks at what you are typing in the Google search box. When you press a key, GS phones home and passes the current contents of the search box. The server returns some suggestions are then displayed to the user. The javascript code is a little obfuscated, more to keep the size down than to obscure the contents.

Good hacks abound!

Profile Picture for Alan Levine aka CogDog
An early 90s builder of the web and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person.