How does Google predict our words?

1.7k views Asked by At

Possible Duplicate:
How does Google Instant work?

Often we use Google to search any content, but when we type any word in the text box of Google's engine, Google tries to predict the word or even recently it uses Google Instant Search to produce the result on the fly. How does this work?

That is without even the user have pressed the search button, how does server send the result immediately? Because as a user we haven't requested for the result, but still server produce a result, how has this been implemented?

3

There are 3 answers

0
Magnus On BEST ANSWER

Essentially, there are JavaScript key event listeners on the search box. When these detect keyboard input, an Ajax request is made to Google's server.
The Ajax request will include the currently entered text, which will likely be compared to popular search terms. A list of possible completions is sent back using JSON, and inserted back into the page using JavaScript.

As for Google Instant Search, instead of returning a list of possible completions, a list of results for the most likely search term you entered will be returned and JavaScript used to update the page.

To learn more about this stuff, it's worth learning about JavaScript, Ajax and DOM manipulation. JavaScript libraries such as jQuery or Prototype can make this stuff much easier.

0
Winston Ewert On

Google uses javascript to send your text as you type it to the server and start showing the results.

0
TobiHeidi On

For the Instant Search result Google will probably just listen for a key press event and if so send a request for the results and then display them.