Google Suggest Dissected 321
sammykrupa writes "Google suggest Javascript code dissected and rewritten for all of you web developers out there. Cool piece of web reverse-engineering!" Joel Spolsky astutely notes that this will raise the bar in terms of how people expect the "internets" to work.
A great idea (Score:3, Informative)
Re:A great idea (Score:3, Insightful)
Re:A great idea (Score:3, Insightful)
Re:A great idea (Score:5, Informative)
I agree with you in that JS menus aren't a very good idea. 10% of surfers have it turned off, and the menu is such a critical part of the site that you want it avaialable for everyone. That's why I also shake my head when I see Flash based menus.
However, there's no need for your solution of a <menu> tag since the <ul> tag and a little CSS already does that just fine.
Read the following articles to see what I mean:
Hope this is of use to you.
Re:A great idea (Score:3, Insightful)
XMLHttpRequest is a godsend that has been used for RPC in most major clientside toolkits for a while now, but you mainly see it in web apps that you have to pay to use (written a few myself). The fact that Google is using it only validates it's importance.
And I don't wish to be pedantic but using the term "non-standardized web sites" is ra
Google Suggest just isn't very useful (Score:5, Insightful)
1. Try something specific
2. Try something less specific
Number 1. brings up no results on Goggle Suggest, number 2. brings up 523,334 results. Impressive, but how has this helped us search for 1. ?
Let's try an example, lets look for "C# structs"
1. Enter "C# structs" - no suggestions.
2. Enter "structs" - 425,000 results.
Grrreat.
Re:Google Suggest just isn't very useful (Score:2, Insightful)
Re:Google Suggest just isn't very useful (Score:2, Informative)
Typing "cstruct" gives one suggestion. Now type "c$%#$%#$%#^struct". It gives the same single suggestion.
I'm not sure exactly which characters it ignores, because it does recognize ".net"
Re:Google Suggest just isn't very useful (Score:4, Insightful)
e.g. search for 'tmp/foo/bar' or 'tmp/foo/bar#baz'. You'll see results for '/tmp/foo.bar', '/tmp/foo/bar', and so forth. What if I'm looking for that exact string? This can be very frustrating when searching for posts about a specific error message, since a page with 'condition foo: bar' will be just as likely to show up as 'foo: bar condition', but they aren't necessarily the same.
Re:Google Suggest just isn't very useful (Score:2)
Re:Google Suggest just isn't very useful (Score:3, Informative)
so "/tmp/foo/bar" is the same as "tmp foo bar", which are very different.
Re:Google Suggest just isn't very useful (Score:2, Informative)
I don't agree (Score:5, Insightful)
Re:I don't agree (Score:3, Funny)
Answers first, then questions (Score:2)
Owen D. Answers first, then questions.
in D.A. Norman & S.W. Draper (Eds.) User centred system design.
LEA Associates. pp. 361-375. 1986
CC.
Re:Google Suggest just isn't very useful (Score:2)
http://www.google.com/search?q=c%23+str
Re:Google Suggest just isn't very useful (Score:3, Insightful)
Hmmm.
Re:Google Suggest just isn't very useful (Score:2, Funny)
Re:Google Suggest just isn't very useful (Score:5, Interesting)
And for those who would like to see it... (Score:5, Informative)
Google with Auto Complete on [google.com] Just start typing in the search field.
It's a beta feature.
Re:And for those who would like to see it... (Score:3, Interesting)
Annoyingly, I'd written almost identical functionality for my own personal use maybe a year before I ever saw it in GMail (though it was already in place when I got GMail so I have no idea when they put it in there) because I really wanted standard combo boxes with pre-populated choices that also let you key in another choice. You could even use the
Firefox users can try the plugin (Score:5, Informative)
Google suggest isn't useful though (Score:5, Insightful)
Re:Google suggest isn't useful though (Score:2)
Re:Google suggest isn't useful though (Score:2)
Re:Google suggest isn't useful though (Score:2)
Re:Google suggest isn't useful though (Score:2, Insightful)
But, in many cases search engines are useful in that they allow us to explore knowledge domains we were not aware of. Suggesting potentially related terms enables exactly this sort of searching.
Don't think of it as search for information you already know you want. Think of it as being exposed to in
Re:Google suggest isn't useful though (Score:2)
Re:Google suggest isn't useful though (Score:3, Insightful)
Honestly, I don't think Google Suggest is where this is going to stop. This is a nice demonstration that we can have real-time feedback on web pages and applications, but I'm thinking more about the future and how t
XmlHttpRequest is cool (Score:5, Interesting)
Eventhough Google suggest looks great, I'd vote on CGI::IRC as the biggest killer HTML/Javascript browser app.
Clientside Javascript is powerful, we never realized how much
Re:XmlHttpRequest is cool (Score:5, Informative)
There are quite a few Flash RSS readers.
Also, (seeing the link in your sig) parts of the BBC site use it - News for timelines (example [bbc.co.uk]) and CBBC used XML to pass data around flash games/apps
The best one I've seen yet it the US Election tracker [bbc.co.uk]
Re:XmlHttpRequest is cool (Score:3, Interesting)
I've also tried my hand at XMLHttp, long before google started using it in gmaill and google suggest.
The result was a php reference [nullcreations.net] and an interesting chat application [nullcreations.net]. Don't know how well the chat client is going to scale though, never had a significant enough number of people use it at once.
(note, these projects were created before safari and opera decided to jump on the xmlhttp bandwagon, so for the moment they'll probably only work in Firefox, Mozilla, Netscape and Internet Explorer)
Re:XmlHttpRequest is cool (Score:2, Troll)
As someone whose been burned^Wjaded^Wexposed to Microsoft innovations before, I have to ask the following:
1. How secure is this? IOW, does it rely on anything at all other than JavaScript on the client side, or does it hook into the OS on some level? If it does, how well is it isolated from the more dangerous bits in the OS?
2. If it does require anything other than JS - even if it does only require JS - is it Windows only, or have our good friends at Microsoft re
Re:XmlHttpRequest is cool (Score:2, Informative)
Re:XmlHttpRequest is cool (Score:2)
The MS and non-MS implementations are subtly different, but nothing major.
Have a look at the Javascript source [merjis.com]. I do some clever stuff to measure the round trip time to the server and slow down updates if they are taking too long. Anyone know how to make updates run in another thread so they don't stop the browser if they're really slow?
Rich.
Re:XmlHttpRequest is cool (Score:3, Interesting)
Re:XmlHttpRequest is cool (Score:5, Informative)
Microsoft implemented it as an Active-X object you could invoke from Javascript - Mozilla implemented it as a native Javascript object. Microsoft calls it "Msxml2.XMLHTTP" or "Microsoft.XMLHTTP" depending on which version of IE you are running - Mozillah has a cleaner "XMLHttpRequest" naming (soon to be in the standards I guess).
So on IE it needs ActiveX enabled to use it . Mozilla version is therfore much safer to use and easier to program with in connectionVisit simple example [apple.com] for a quick and dirty example :)
Re:XmlHttpRequest is cool (Score:2)
Of course, being a good MS developer, one should always look into the issues you posted...
1. How secure is this? IOW, does it rely on anything at all other than JavaScript on the client side, or does it hook into the OS on some level? If it does, how well is it iso
Re:XmlHttpRequest is cool (Score:3, Informative)
This is incorrect, DOM 3 Load and Save [w3.org] was finalised back in April, and it has been implemented by multiple browsers already. You still have to mollycoddle Internet Explorer of course, so you may not think that it's worth your while to implement the W3C approach, but that's your call.
Re:XmlHttpRequest is cool (Score:2)
Darling, I did that in 1999 for a web application I developed for a major financial services corporation. It had a tiny frame which was controlled by javascript in another frame. The loader frame would load in pages which had the same background color as the primary page, so people didn't tend to notice it, and the pages it loaded would just contain
Re:XmlHttpRequest is cool (Score:2)
Interesting & nifty, but little else (Score:3, Insightful)
It could potentually save a user some time, but could equally slow down their search by confusing with a multitude of options.
Re:Interesting & nifty, but little else (Score:2)
Censored!!! (Score:4, Funny)
Interestingly enough, they DIDN'T censor the racial slurs. "gay nigger" happily suggests "gay niggers from outer space" among other things. Also, type "tub" and one of the suggestions is "tubgirl".
Re:Censored!!! (Score:4, Interesting)
As a concerned parent (I'm not, but pretend) I wanted to help protect my teenage daughter so I looked for information by typing "sexual diseases". Granted the search would have worked, but as an unknowledgable home user I thought there were no results.
IMHO, as well as prompting with common queries not involving any sequences of glyphs that the pope might blush at, google suggest should treat people with more respect and also return suggested spelling corrections and search result count for all exact search queries.
At worst, if the user types "cunt", google suggest should include all suggestions with "cunt" in them. And in that case where it is an extremely offensive word to white heterosexual christians (as that appears to be the only metric by which google can be bothered to censor), if the user types it, google should produce suggestions including less offensive words too.
Re:Censored!!! (Score:2)
Re:Censored!!! But only in English! (Score:5, Interesting)
Therefore, at present, this works only for English; with other languages it can happen that it suggests porn-prone search terms for the refinement of terms that have, as such, nothing to do with pornography. Some examples:
Beware (Score:5, Interesting)
Small sites should *not* try to do this kind of thing on a live site. The amount of pressure this could put on a bad database structure (or even a well formed one) is considerable. Think about how many database hits a user could perform in a very short space of time: (user enters something, (database hit) backspace (database hit) types another letter (database hit)), then multiply it by a hundred or more people if your site gets a moderate amount of traffic.
Google can get away with this because they have considerable bandwidth, and large server farms. We've been seeing people trying to copy google suggest for the last couple of weeks in #javascript/freenode and in #php/freenode. The people trying to copy it generally do not understand how potentially bad this can be for a single server.
Anyhow, my advice is, don't do it unless you have the resources to scale your site. The cost of such an insignificant feature (lets face it, all it does is save the user one or two clicks) seems like it outweighs the gain. If you do decide to do it, and your site gets popular, and you're on some kind of shared host, your sysadmin is going to hate you, and the other site admins will probably meet you at your house, torches in hand.
Re:Beware (Score:5, Informative)
It's pretty easy to spot, as the number of results shown in the preview doesn't match the number of results when you hit enter.
This makes perfect sense, since a "real" lookup would generate way too much heat. But, it's also dangerous, because people are led to believe that what they're typing would'nt yield a result. This is wrong. A simple proof of concept. Type sex. It says 0 results. But if you hit enter, you get a godzillion.
Re:Beware (Score:2)
That's not a good proof of concept. Google seems to filter certain keywords deemed inappropriate, and sex is one of them. So this is deliberate and not a side-effect of caching the results in a lookup table on Google's side.
I don't actually know how Google does it - I agree that the naive approach probably stresses their servers too much to be widely used. OTOH this is only a beta test, and it's possible it
Re:Beware (Score:2)
Re:Beware (Score:3, Informative)
Re:Beware (Score:3, Insightful)
If I were to hazard a guess, I'd say it's probably only good for small (less than 1000 items) search lists.
Re:Beware (Score:5, Informative)
In a naive, client-side caching system, if you DID manage to request all the suggestion strings in the client, eventually you would have the entire array client side, but you'd probably start throwing away the old data at some point.
This technique exists since a long time ... (Score:5, Interesting)
If you look for more XMLHTTPRequest examples, which tightly integrate JS and PHP (other server side languages would be possible), see JPSpan [sf.net].
I don't quite understand all the hype about Google Suggests. The technique for doing it exists since at least 2 years on Mozilla (and even longer on IE). Therefore, doing something like that was possible since a long time, but maybe everyone was just scared of using JS for "serious" stuff..
Re:This technique exists since a long time ... (Score:2, Insightful)
well.. it is the power behind it that's coursing all the hype. Google IS power because it has a very wide audience. Think about it like this: What would happen if Google would start producing a custom Open Source OS? A LOT of companies have their own Linux or BSD versions and some did succeeded in receiving some public exposure BUT if Google would post
Is it that big a deal? (Score:4, Interesting)
Google have good UIs because they hire smart people. Other people don't because they don't hire smart people, or hire the wrong type of smarts (graphic designer instead of sw engineer for the coding part of a website, and vice versa).
Re:Is it that big a deal? (Score:2)
Re:Is it that big a deal? (Score:3, Insightful)
Overestimating the engineering (Score:3, Interesting)
XmlHttpRequest to fetch data on demand has been around for a long time. For example, MSDN has been using this technique for years now. I have been using it for 9+ months on an application that recently went into production.
The reason you have not seen it in use much is
XMLHTTP (Score:4, Interesting)
XMLHTTP is a COM object included with recent versions of Internet Explorer. You can call it from client side JavaScript in a web page. The object will make a request to the URL you specify, and return the result into either a string variable, or an MSXML DOM object. You can then have the javascript output the results to an object (eg, a div tag) on the page without doing a full page reload.
I wrote a small tech demo that implemented a virtual tree - so when you expand a branch in the tree the client only retrieved the data it needed. This was borrowed from the approach the MSDN web site uses. The advantages to it are that it doesn't download the same data over and over like when you expand a branch in a server side tree. You also don't have to do any work at all to remember the state of the tree since there's no full page refreshes involved.
Google Suggest is similar in that it is a virtual list rather than a virtual tree. A virtual list allows you to list lots of items and jump around in the list without needing to download the entire data set when the page was loaded.
Another use for this would be dynamic forms - forms that alter the state of controls based on selections the user made in previous controls.
The biggest suprise to me was that Google have implemented this on a site live to the public. In using XMLHTTP I found it a little bit prone to locking up the browser when waiting for responses to requests. Additionally it's Windows only, so could never have been implemented on an external web site.
I'll be looking with interest at the Mozilla side of Google's implementation, since I didn't think an equivalent existed until now. Two different implementations of the same functionality is still going put a damper on the technology though.. different code for different browsers is usually more trouble than its worth.
Re:XMLHTTP (Score:2, Informative)
Re:XMLHTTP (Score:3, Informative)
What I think is cool about the Google implementation of XmlHttp is that it's run asynchronously so it won't lock up the page.
Not Windows only (Score:3, Informative)
Furthermore, you can use asyncronous requests to avoid lockups. Having the Google server farm and bandwidth wouldn't hurt either, of course.
It's also possible using a hidden iframe (Score:2)
I didn't use the XMLHTTP object to do this, but I implemented something similar a while ago. I think I originally tried to use XMLHTTP (or possibly something similar), but ran into Mozilla security issues that were blocking it from being used without requiring the user to have a heap of trust-related things set up in a friendly way. (On the other hand, I didn't go to great lengths to figure out if I was using it properly.)
The trick I used, which I borrowed from kuro5hin [kuro5hin.org] and it's dynamic comment fetc
scary computational power.... (Score:5, Interesting)
1. Google performs several possible searches for each key you press
2. Google already knows the estimated number of results for millions of queries
Both of these suggest a heck of a lot of computing power. This type of thing might not scale up for general use in the near future - but still...
we're talking massive computational power and one of the largest databases ever created.
I'm a bit worried the Googleplex is going to wake up one day and declare to all us 'organics':
"yo bitches - you work for me now"
Re:scary computational power.... (Score:2, Informative)
Re:scary computational power.... (Score:3, Informative)
1. Google performs several possible searches for each key you press
Very unlikely.
2. Google already knows the estimated number of results for millions of queries
More likely....and they already "know" those numbers because they use it in their normal search. It doesn't require computatioinal power to get those numbers, just time. And the lookup for those numbers should be reasonable fast (hash lookup or whatever).
Re:scary computational power.... (Score:2)
Man, what I wouldn't give to be a kid again.
Patented? (Score:2)
DDA Compliance? (Score:4, Informative)
As others have commented here, I'm not convinced that the Google feature is in fact much more than eye-candy; and thus, since it doesn't really add any functionality, isn't really covered by the DDA. However, as soon as it actually becomes useful for something, then it will be covered; and I don't fancy the job of getting JAWS or something like that to interpret the JS in a meaningful way!
everything you type in is directly send to google (Score:4, Insightful)
Re:everything you type in is directly send to goog (Score:3, Insightful)
Somehow, I doubt someone at Google sees the search term "vZ820aa3q" and thinks "oh, that's mrmorgana's Slashdot password"...
Why this matters (Score:2)
Some browsers/web sites switch contexts when they shouldn't. Firefox on Windows, for example, takes over the UI context (contrary to Windows UI standards) at times. Google has sites that take a second or so to load even on a high-speed link; start typing into a field in the Google Groups advanced search box, and then see the active field change so you're now typing into a different box when the page finishes loading, for example.
A better outlet for this technology... (Score:2, Insightful)
I figured that out last week (Score:2, Interesting)
The next thing I need to do is include the value of the dropdown box and limit the results on that.
Obligatory Bush bash (Score:2)
Couldn't just post the story without bashing Bush, could you?
oh god, the language! (Score:2)
The Goole Suggest Alphabet Game... (Score:5, Interesting)
This makes for an interesting way to sum up the internet into 26 words/phrases.
Check it out:
A - Amazon
B - Best Buy
C - CNN
D - Dictionary
E - eBay
F - FireFox
G - Games
H - Hotmail
I - Ikea
J - Jokes
K - Kazaa
L - Lyrics
M - Mapquest
N - News
O - Online Dictionary
P - Paris Hilton
Q - Quotes
R - Recipes
S - Spybot
T - Tara Reid
U - UPS
V - Verizon
W - Weather
X - XBox
Y - Yahoo
Z - Zip Codes
If I had to sum up the internet in 26 words/phrases, I don't think I could have done it better than Google. Of course, that is keeping in mind that Google Suggest has some pretty serious filters in place, so instead of P being "Porn" it is "Paris Hilton." Not too far off, if you think about it.
Great crutch for the pathetic browser (Score:2, Insightful)
Everybody is writing apps to work in the ubiquitous browser. Unfortunately, developers have to jump through many hoops to get browsers to sport friendly interface elements that are already available in the X / Windows / Mac interfaces. The browser was never meant to be an application front-end, but it's being forced upon us developers, costing more time to get a workable product banged out. A compiler and class libs can d
Explotable? (Score:2)
A truly amazing web interface (Score:2)
While they do use HTC's and behaviors, the result is astounding -- a fully responsive, dymamically updating UI that never needs to go back to the server for a full-screen refresh. It also looks and feels exactly like using Outlook 2003 on the desktop, drag-n-drop, sorting, right-clicking and all.
What we really need is a cross-browser way of coming up with a rich inter
Coming next week: (Score:2)
Wolf 5K Dissected (Score:3, Interesting)
The task of deobfuscating code is quite tedius but not too daunting. The main thing is getting the whitespace back in so you can see where all the functions begin and end. You then have to understand the language well enough that you can read the code and figure out what's going on without hints from comments or descriptive variables.
For Wolf5K I just started by working on the simple functions first and then by process of elimination worked my way through the code and finished with the raycasting function.
Translating it all to C++ was then quite easy because by then you have a very good grasp of how the code is suppost to work.
People missing point or article - rich web apps (Score:3, Insightful)
But that is not what the story is about. The story is really about all the little things that are going on that make a very usable and responsive web interface.
Others have noted the XMLHTTPRequest object at work. But there are a number of other cool things in there:
Replacing XMLHTTPRequest with a cookie/frame reloading technique.
Using javascripts Timeout() handler to initiate server communication, so that fast typers are not penalized with a lot of excess network requests.
Interesting JavaScript text manipulation (like highlighting).
Basically, just a lot of little things that show how to make some interesting techniques useful for the widest audience possible. Google Suggest may on the face of it not look like the most useful thing ever, but you have to respect the sheer number of browsers it is designed to work on and the responsiveness of the interface.
suggestion for a better "google suggest" (Score:4, Interesting)
why? valuable implicit information gained through the human-computer interaction is not fully exploited by "google suggest". for illustration, see the following example:
let's say i'm searching for "southwest". and for the sake of logic, let's assume that i either don't know the correct spelling or that i'm a lazy dog
now comes the problem:
the top result displayed [google.com] by google is.. southwest airlines! this of course doesn't make sense because if i wanted to search for southwest airlines, i would have happily accepted google's first suggestion already. actually, "google suggest" knows about my preference for "southwest" over "southwest airlines" and yet doesn't use this "extra-"information gained thanks to human-computer interaction! so my brain feels slightly offended
to put it simply: if an average user is selecting a search term from a list of suggested search terms, he probably wants to search for that exact search term but not for any of the other also displayed suggested search terms. if not, an average user would have probably selected another search term out of the displayed list of suggestions. so to me, this looks like if the bright google guys forgot about the fact that the act of selection from a list also implicitly includes information about what does not get selected.
suggestion for a better "google suggest":
as a probably not perfect but working solution, "google suggest" could simply exploit this implicit user interaction information by excluding all explicitly deselected (and eventually all not explicitly selected) suggested search terms from the search query. in the example:
excluding all explicitly deselected search terms yields:
southwest -"southwest airlines" [google.com] (voilà! southwest airlines is not the top result anymore
excluding all explicitly deselected and all not explicitly selected search terms:
southwest -"southwest airlines" -"soulseek" -"south park" [google.com] (etc.. you get the point)
that's pretty easy to implement - with an obvious benefit for average users.
disclaimer: i'm talking about expectations of average users here. iow: about users that are probably just interested in the few topmost results, i.e. the intersection and not the set union of results (but that's probably the point of web searching anyway
Re:DCMA (Score:5, Funny)
Dyslexic users of slashdot, rejoice!
throwing out DCMA (Score:4, Funny)
Re:DCMA (Score:3, Funny)
Re:DCMA (Score:2)
Re:Raising What Bar? (Score:3, Funny)
Duh, its google-related. It must be better than everything else, thus raising the bar.
Clearly.
I kinda disagree with Joel's thesis (Score:2)
People know when they're sitting behind copious bandwidth. And you could well grow accustomed to an all-text page weighing the better part of a megabyte, due to a heinous amount of information parked in hidden JavaScript data structures, giving you that near-whiplash inducing responsiveness.
(Ah, the ghosts of projects past...)
Then again, you also know when you're on a cell phone, and the information you really need is already at the to
Re:I kinda disagree with Joel's thesis (Score:5, Interesting)
In fairness, Google Suggest, like Gmail, works very nicely for me on a 56k dialup. Gmail takes a few seconds for its inital load, true, but then it's like lightning. Suggest doesn't even have the slow initial load, since webhp.htm comes in at only 3.6kB. I'm very impressed.
Now I've no doubt that the bandwagon will bring us massive slow bloat as everyone gets his dog to code up vaguely similar functionality, but Google haven't done that.
Re:Raising What Bar? (Score:2, Insightful)
Regards,
Steve
Re:Too Busy! (Score:2)
When it was adopted by the Visual Studio team and dubbed Intellisense, massively.
Google Suggest may end up being the same way - not too useful in its current incarnation, but a huge usability boost when a solid usage for it is found.
Re:Is the time coming? (Score:5, Interesting)
Today, we have two languages (XHTML and CSS) instead of one (HTML), and while it certainly does a lot to improve interoperability and platform independence, it is two languages to learn, not one. Throw in stuff like JavaScript, and you have even more.
Of course one can choose not to use XHTML and CSS, but that's not the way we want it, right? We want people to use the standards, to write code which won't crash Firefox, or not use proprietary solutions. Doing this is taking more and more effort. We have the skills and time to do and learn this, but not everyone have.
If we want a wide adoption of standards, and an Internet for everyone, where everyone has equal opportunities, the only way is to make the standards easy to use, so people will use them of their own free will.
Otherwise, in 10 years we'll be designing our fancy webpages, while the Joe Users who don't have the time or skills to learn the 13 languages required have no choice but to hire a professional, or use a crappy proprietary solution which won't allow them to take their ideas to their full potential, and this is a great loss for everyone.
Saying "You must do *complicated thing* because it's the specified standard!" will only work with people like us.
Re:Is the time coming? (Score:2)
Re:Is the time coming? (Score:2)
If you can take a 10 year old piece of junk and fix a complex bug in under an hour... people will pay for that. If you can manage a project to completi
Re:Is the time coming? (Score:3, Interesting)
*cringe*
This works just fine until something doesn't work *perfectly*, and then all hell breaks loose. I will give you a real world example. I'm currently working at a law firm (I'm starting law school in either fall 05 or 06) that uses a common "indstry standard" database tool -- it is a flat-file DB that uses B+ trees. [B trees are like binary trees, but they have many children instead of tw
Re:google.com? (Score:2)
Damn, you're right. Worse, my possible solution [google.com] redirects to www.google.co.uk/firefox.