GSuggest

Yesterday Google released a very nifty upgrade to their search tool, which allows you to choose from a list of popular hits depending on what you are typing on the search box.

After taking a quick look at the JavaScript code and sniffing my network to see what my browser was doing I was able to somewhat figure of the basics in the technique. Everytime you type something the key event is captured by the browser which in returns sends a query to a special url at google using a XMLHttpRequest object. This object essentially allows the browser to get data from a server in the background using JavaScript without leaving the current page. Each character you type in the search box, produces a query which then spits out the array of results used to populate a floating div used as the list of suggestions. The resulting code is really small (~20KB usually) and it’s compressed. At the present time this probably barely tickles google’s boxes but it would be interesting to see what will happen when this tool gets out of beta and more people start using it.

Anyways, this new toy was too cool to leave aside so I spent most of the night hacking together a proof of concept Firefox extension to add Google Suggest like behavior to the browser’s search tool. Just to show how great XUL/XBL/XPCOM is.

I’ve also created a small search plugin for Google Suggest so the extension only runs when this custom search plugin is in use to avoid any conflicts with the main Google search plugin.

New Google’s Suggest

Google Suggest

Firefox GSuggest Extension

Google Suggest Extension

Obviously Google’s is much better hehe.. and there are still some issues with GSuggest’s results
list (ie: lack of keyboard navigation) but you can test it out by following the steps below.

  1. Install GoogleSuggest search plugin-in
  2. Install GSuggest extension
  3. Restart Firefox
  4. Choose GoogleSuggest as the search engine in the Search toolbar


NOTE: Use this extension at your own risk – It is only a proof of concept. The author takes no responsibility of direct or indirect damages caused by this program.

Known Issues:

  • Mainly tested on win2k ff1.0!
  • The result list lacks of keyboard navigation, you need to use your mouse to select result to query
  • On Linux FF 1.0 the result list is not updated properly.
  • Depending on how fast you type, there might be some lag in getting the result list to refresh properly
  • Obviously if google decides to change delivery format, script location, etc. this will break..

Read More