Searching for symbols via Google is hard

Hokay. Google is without a doubt the single most useful and successful tool ont’Internet, a marvellous success story and something most of us would miss deeply until the happy day it’s superseded by something Even Better. It’s fast, it’s got a nice simple interface, and most of the time it “just works” and gives you what you want.

Unfortunately, some of the time, it really doesn’t “just work” (for me, at least) and in an apparently non-fixable way. I usually hit this when I’m doing programming-related searches.

For example, times is the name of a commonly used method in Ruby. Suppose we want to find out how it usually works, and maybe see an example… Googling for ruby times, what do we get? Well, Google has “intelligently” turned “times” into “time”, so we get lots of hits about the Time module in the standard library. D’oh!

Now, we can get round this: putting double-quotes around the word “times” forces google to take it literally, as does prefixing it with a +.

However, the situation’s trickier when it comes to symbols – which can be a real pain for programmers. Google simply strips out most (but not all) non-alphanumeric characters, as far as I can tell. One can grudgingly admit that that’s quite sensible in terms of indexing the Mobybytes of data on t’Internet, but sometimes it does bite one in the ass…

To pick an extreme example, maybe we want to know about the $\ operator (in Ruby, again). Googling for ruby $\, the $\ gets stripped completely, and we get the same results as just googling for “ruby”. Bah! Quoting doesn’t help here, either. Not all symbols are stripped, though: googling for ruby $_ is quite successful (update: ooh, actually, no it isn’t – the first hit just happens to include a $_ in the summary?). Parentheses are stripped, however, even with quotes – yicks! And echoing an earlier example, what if we want to search for +? (Or ++?) There’s just no way! Quoting doesn’t help, putting a + in front doesn’t help, putting it in quotes and putting a + in front of that doesn’t help… :-)

This is sometimes very frustrating. If the advanced search had an option for “really do search for exactly what I say, please” that would be nice, but alas, it don’t. Sometimes, it seems, you just have to get imaginative.

So: does anyone know a way round this? Or a better search engine to use when this bites?

15 Responses to “Searching for symbols via Google is hard”

  1. July 25th, 2006 | 10:19 am

    A way round this – use Python instead. Far fewer symbols. ;-)

  2. Dave
    July 25th, 2006 | 10:37 am

    Have you come across Krugle? A few sample searches from your post bring back some bits which look (potentially) relevant.

  3. July 25th, 2006 | 10:43 am

    Simon: true, but try searching for __foo__ for appropriate values of foo. :-) I’m sure that’s got me in the past. And as much as I love python and it will always be my First Favourite Programming Language, I have to say, I’m getting sucked deeper and deeper into Ruby. Avoiding horrid Perlisms is a virtue to be cultivated however – yes!

    Dave: I hadn’t, and yay, it looks funky. Although, it didn’t seem too successful with $\ or $_ when I tried it…?

  4. Andy
    August 13th, 2008 | 1:56 pm

    I have the same problem. I can’t figure out what the symbols are in the code, and I can’t search them either.

  5. November 14th, 2008 | 8:51 pm

    yeah, this is stupid.. im trying to learn about a hacker called \’)/* you try googling that.
    Its just stupid, and iv been trying to google the aswer to this Q for the last hour.. nothing.. this page is what came closest, simply by being relevant.

  6. RAVI JODHANI
    April 18th, 2009 | 6:30 am

    APRIL 18,2009.

    I WANT TO GET SYMBOL(LOGO) OF GOOGLE SEARCH ENGINE,BUT CAN’T…..SO,PLZ GIVE ME TRICK TO DOWNLAD IT……

    I M WAITING UR REPLY…….-RAVI JODHANI(AHMEDABAD)
    GUJARAT
    INDIA.

  7. Joel
    May 30th, 2009 | 3:12 am

    Jesus, why do you indians never read anything before asking questions? Sorry, tech support bitterness here :P

  8. Will
    November 3rd, 2009 | 1:38 am

    I’m not gonna lie, that may be the funniest interjection i have ever seen in a web posting.

  9. Nitesh
    March 30th, 2010 | 12:12 am

    ravi calm down. start by releasing caps lock. then using proper grammar. then read the article. simple.

  10. Fran
    November 12th, 2010 | 9:44 am

    I know exactly what you mean. Just now I was trying to find information about the “->” operator in C++. And it’s impossible to search for in google. Driving me crazy. It’s just a simple little question that should be readily available via Internet search. Don’t know the difference between -> and the usual dot syntax I see in other languages. Google you failed me.

  11. November 12th, 2010 | 11:00 am

    Copy of email just sent to previous poster…

    I don’t know if you figured this out yet, but it’s actually quite simple. The distinction originates in C, not C++. Quoting from the C bible, K&R, section 6.2:

    Pointers to structures are so frequently used that an alternative notation is provided as a shorthand. If p is a pointer to a structure, then

    p->member_of_structure

    refers to the particular member. … so if we have

    struct point {
        int x;
        int y;
    };
    
    struct rect {
        struct point pt1;
        struct point pt2;
    };
    
    struct rect r, *rp = &r;

    then these four expressions are equivalent:

    r.pt1.x
    rp->pt1.x
    (r.pt1).x
    (rp->pt1).x

    If you want to find out more, it might be worth knowing that “->” is called the “structure pointer operator”, and that “.” is called the “structure member operator”. If you google these terms, you’ll find lots more info.

    It’s also always worth getting not just books, but _good_ books to refer to. Anybody using C should have K&R on their desk, and if you’re programming in C++, you’re using C enough that you won’t regret having a copy, IMHO.

    Hope this helps!

  12. November 23rd, 2011 | 4:10 pm

    You should try using http://www.symbolhound.com
    [full disclosure: my site]

    SymbolHound is a web search that does allow the special characters that Google ignores, such as @#$%^&*()=+[]\.
    As stated in the article, Google ignores these characters, even if they are in quotes.

    SymbolHound should be a useful tool for programmers!
    Good luck

  13. someguy
    February 9th, 2012 | 4:37 am

    Tom, as someone trying to teach himself ruby, your site’s a godsend

  14. March 12th, 2012 | 6:15 am

    Thanks, someguy! Glad it could be a useful tool. An update: we now also have source code repo search (much like the now-discontinued Google Code Search)- http://www.symbolhound.com/codesearch

  15. Steve
    April 10th, 2013 | 1:37 pm

    @TomFeldtmose Good work – love the site.