Google Suggest, how it works?
Asked Answered
J

3

6

How does Google Suggest work? How does it manage to update the web page on the client so quickly, based on information in a distant Google database? Why does the web page not look ‘jumpy’ if it is being frequently updated?

Jedlicka answered 25/6, 2011 at 15:34 Comment(2)
@slhck no, I meant Google SuggestJedlicka
Google Suggest is the auto-completion of your search query. It is distinct from Google Instant which updates search results based on the top suggest.Catie
W
9

It uses AJAX.

When you are writing your query, it searches for the 10 most requested words matching yours. Then it writes minified JSON on an invisible DIV element. Fast, but still resource intensive.

Try to install Firebug on Firefox or use the Developer Console on Chrome, open the console and start writing "Youtube" or whatever you want. You will see the minified JSON responses.

Good luck :D

Weaken answered 25/6, 2011 at 15:40 Comment(3)
Google Search uses jQuery? I doubt it.Catie
Google uses jQuery in some products for sure, I didn't think search though. And a quick look in Firebug I can't see anything jQuery for Search.Catie
True, but the suggest's GET call is identic to jQueryUI's autocomplete. And the custom HTML tag autocomplete is on the search box too... Don't know now...Weaken
V
4

In addition to the front-end handling others have talked about, which jQuery is a great example of, you might also be interested in how they approach the idea on the backend. Dr. Peter Norvig has written about how to create a spelling corrector, where similar approaches could be used to find close matches.

Vichyssoise answered 25/6, 2011 at 15:44 Comment(1)
AFAIK Google Search does not use jQueryCatie
C
1

The whole page is not being updated. Only parts of it are using AJAX - Asynchronous Javascript and XML. Ajax requests can be made in Javascript, and the page updated when the response comes back.

A far more interesting question is how does Google actually search 10bn+ documents in a teeny tiny fraction of a second :)

Catie answered 25/6, 2011 at 15:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.