- This topic is empty.
-
AuthorPosts
-
May 26, 2009 at 4:26 pm #24971mattvotMember
Does anyone know how Google.com Youtube and twitter do their live search. You know, where they predict what your typing?
And a practical way of duplicating the effect?
June 2, 2009 at 9:14 am #58419csscollMemberTwitter searches the media that people are sharing on twitter. so it’s like performing a google search but limited only to the part of the web that people are sharing links to on twitter.
For google search you can refer to this link
June 4, 2009 at 1:10 pm #58583HugoMemberI think he means the ‘AutoComplete’, those are the suggestions that pop up right under the input field.
The way google (and other websites) do this is by using AJAX – every time you press a key (hence: typed a letter) while focused on the input field, the google page does an XMLHTTPRequest to a server, and the response of the server is used to ‘predict’ what you’re going to search for.
In human language: Say you typed the letter H into the google search field, a request is sent to a page on the google server, and this page searches the database for everything that begins with an H. Finally, it returns the results to ‘your’ page showing the suggestions – everything the server found that starts with H (most probably limited to 5 or 10 results or so). Same goes for when you type more, so when you typed an U after the H, google’s server will look for anything that starts with HU. This all happens in about 1/10th of a second.
Using the Firebug extension you can see the requests that google performs ‘around your back’:[img]http://img14.imageshack.us/img14/5822/exampleucr.th.jpg[/img]
Hope this answers your question (I found this very interesting as well someday)
June 4, 2009 at 4:33 pm #58593mattvotMemberThanks, That’s the answer I wanted!
So it searches the whole database? It seems like that would require alot of processing. DO you think they cache different combinations?
June 22, 2009 at 5:59 am #59504HugoMemberYes they certainly do cache certain combinations, depending on your language. They also have an entire database containing a lot of possible typo’s for each word, so they autosuggest stuff even when you’ve spelled it wrong. This indeed costs a lot of processing, but then again: google has a ton of servers with a lot of processing power.
June 22, 2009 at 1:12 pm #59535mattvotMemberi see…
thanks for the help, but this now seems a feature too complex for my simple mind. ha
-
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.