Slashdot Log In
Google Suggest Dissected
Posted by
michael
on Sat Dec 18, 2004 04:05 AM
from the rated-r-for-responsive dept.
from the rated-r-for-responsive dept.
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.
This discussion has been archived.
No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
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.
I don't agree (Score:5, Insightful)
Parent
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.
Parent
Re:Google Suggest just isn't very useful (Score:5, Interesting)
Parent
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.
Firefox users can try the plugin (Score:5, Informative)
Google suggest isn't useful though (Score:5, Insightful)
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]
Parent
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 :)
Parent
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!!! 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:
- the first suggestion for 'fille' (French for 'girl') is 'nue' (naked)
- the 5th suggestion for 'dzieci' (Polish for 'children') is 'nago' (naked)
- suggestions for 'mund' (German for 'mouth') countain 'mund auf sperma rein' (open mouth, introduce sperms), 'mund ficken' (fuck in the mouth), "mund arsch" (mouth ass)
- devochki (with Cyrillic letters: Russian for "little girls") gives the suggestions "devochki porno"
- the first suggestion for 'smot...' with Cyrillic letters (smotret': Russian for 'watch'/'look at') is "smotret' porno"
I think this is probably quite problematic - someone enters a search term that has nothing to do with pornography, and Google suggests something pornographic for 'refinement'. Of course, this is not due to Google's intent, but due to the distribution of the things people search for and of contents on the Internet. I suppose this is one of the problems Google will want to address before offering Suggest as an option on the main page.Parent
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.
Parent
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.
Parent
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..
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).
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.
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"
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.
Re:DCMA (Score:5, Funny)
Dyslexic users of slashdot, rejoice!
Parent
throwing out DCMA (Score:4, Funny)
Parent
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.
Parent
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.
Parent
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.
Parent