Slashdot Mirror


Google Suggest

Cristiano writes "As you type into the search box, Google Suggest guesses what you're typing and offers suggestions in real time. This is similar to Google's 'Did you mean?' feature that offers alternative spellings for your query after you search, except that it works in real time." It crashes Konqueror, but works nicely on Mozilla. Update: 12/11 by J : The engineer who thought of it, then built it in his "20% time," blogs about the process.

7 of 655 comments (clear)

  1. Crashes Konqeuror? by Shaman · · Score: 5, Informative

    Not mine. Worked like a charm. Version 3.3.2 on Gentoo Linux 64bit

    --
    ...Steve
  2. Re:Cool! Just like form AutoComplete by dustinbarbour · · Score: 4, Informative

    Yes, it would be intensive for their server should everyone decide to use it in place of standrd Google search. However, the algorithm behind their "Did you mean" runs in O(n^2) worst case and O(n) best case. Not too shabby.. The algorithm is what makes it possible.

  3. Re:Cool! Just like form AutoComplete by eln · · Score: 3, Informative

    big-O notation

    (definition)

    Definition: A theoretical measure of the execution of an algorithm, usually the time or memory needed, given the problem size n, which is usually the number of items. Informally, saying some equation f(n) = O(g(n)) means it is less than some constant multiple of g(n). The notation is read, "f of n is big oh of g of n".

    Strangely enough, I got this definition from a Google search.

  4. Re:How is it so FAST!? by nacturation · · Score: 3, Informative

    Type livesearch into the box and hit I'm feeling lucky. You'll then find the details of what I'm positive inspired this. Essentially, as you type it passes data via an XMLHttpRequest control to the server which then returns a list of the top 10 elements and the page gets updated.

    --
    Want to improve your Karma? Instead of "Post Anonymously", try the "Post Humously" option.
  5. Implementation details by JavaRob · · Score: 4, Informative

    The source for the page is quite simple; most of the work happens in a condensed JavaScript library. Not easy reading (note the word "condensed" above, meaning function and variable names are 1 or 2 chars, and all extra whitespace was removed...), but it's actually pretty straightforward.

    It disables your browser's autocomplete on that textfield (for obvious reasons). Then it basically just defines a hidden div for that auto-complete dropdown (variations on this depending on browser... frickin' incompatibilities).

    Each time you type a character, it populates that div body with the results of a quick, tiny query back to Google. It's NOT running the search for you; it's hitting (I assume) a simple, probably totally in-memory list of the most popular searches and number of results. That's how it can be so quick a response -- the lookup on their end is super-minimal, and the data to be transferred is probably less than 1k each time.

    Cool. Nice concept, nice execution. And one of those nice "only obvious in hindsight" additions.

    Even cooler -- it looks like (from the js file) they are supporting multiple languages here, not just English. Anyone using want to test this out for me? I think even Chinese is supported (or maybe that's the one that isn't.. I don't want to take the time to parse this properly).

  6. Re:URL is same, with ?complete=1? by Wiseleo · · Score: 3, Informative

    In the IE version, here is the function (for those curious how it all works, download www.google.com/ac.js)

    function jb(){var A=null;
    try{A=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{A=new ActiveXObject("Microsoft.XMLHTTP")}catch(oc){A=nul l}}if(!A&&typeof XMLHttpRequest!="undefined"){A=new XMLHttpRequest()}return A}

    This function is obviously copyright google, inc., but being presented here for educational purposes only.

    --
    Leonid S. Knyshov
    Find me on Quora :)
  7. Re:URL is same, with ?complete=1? by samrolken · · Score: 3, Informative

    This is the same mechanism by which the Gmail application receives its data. It seems like Google has become a big fan of this XMLHTTP object and its Mozilla cousin. It's a great way to give web applications access to live data without requiring a page refresh.

    --
    samrolken