Google Code Search is dead


3 February 2012, by

One of the best online tools for programmers, Google Code Search, is now dead. This amazing tool was very useful for looking through open source code. You could just type in a class name, or an error string, and be taken instantaneously to a hyperlinked, browseable source listing. This search engine was one of my most used bookmarks.

So what can we use instead?

  • In many cases your IDE debugger will provide the information you want – and often in a more useful fashion.
  • Otherwise, there are plenty of other search engines you can try.

IDE debuggers

Java

For Java, if you have Eclipse set up properly (especially on a Maven project), it should be able to auto-download source for most of your JARs. You can control+click on a type name, and (after a short pause on the first occasion), Eclipse will show you the source. Of course, the search functionality is not as good as Google, but you can still right click on types and members and choose “find references”. Eclipse will search inside all your JARs, as well as in your workspace. You can even debug inside the 3rd party code. When this works, this is often even better than GCS.

There are a few JARs whose owners don’t properly upload the source to Maven, so this won’t work. See the other options below for these.

I would expect other Java IDEs to have similar functionality, but I haven’t tried any recently.

C#

For C#, Visual Studio has very similar functionality, especially if you have ReSharper installed, which takes care of connecting you to a Debugging Symbol server and even decompiling 3rd party code on the fly. Just as for Eclipse, you can debug inside 3rd party code.

While these both work very well for debugging 3rd party code, there is a major use case of GCS which they don’t meet, which is finding examples of APIs in use.

Other search engines

There are a few other search engines which attempt to do the same thing that GCS did.
The discussion at the closing announcement of Google Code Search links to a few, including the following:

http://koders.com/ attempts to do much the same as GCS, and works OKish. They have been promising a major update for some time, so it could be about to get a lot better.

http://grepcode.com is tolerable, but a bit ugly and Java only. It’s a little better than Koders for Java-specific searches. The source code is weirdly formatted — comments are HTML/javadoc formatted inline with the source, which is jarring, but OK once you get used to it.

http://searchco.de/. This search engine is code-focussed, but isn’t quite a drop-in replacement for GCS. All the Java searches I tried linked to JavaDoc, rather than source code. It might be useful for searching for programming terms which contain symbols or which are ambiguous with non-software terms.

If anyone has any better suggestions, or thoughts on the above, please let us know below!

Tags: , , ,

Categories: Technical

«
»

9 Responses to “Google Code Search is dead”

  1. Ben Boyter says:

    Hi Richard.

    I am the author of searchco.de Thanks for trying it.

    To alleviate the issue where people cannot find code I have switched it over to search code by default rather then through regex syntax or using the checkbox. This should resolve your issue I would hope.

    Let me know if you have any bad queries or experiences and I will be sure to get onto it ponto for you.

    Ben

  2. Susie Bily says:

    Hi! I’m the product manager for koders. Development work is underway! The source for the code search will be ohloh.net projects and their code enlistments. We have more scalability work to do. Check out Code Sight to get a preview of the UI coming in Koders (filters, etc.). We’re still adding search bundling, preserving-the-underscore, more parsing, and an architecture change to allow one project to have many code enlistments. lots to do… but we’re getting there! @koders

  3. Hi Ben,

    Thanks for your reply.

    As one difficult example, recently I was trying to find the source code to “org.apache.soap.rpc.Call” (this seems to be a very old Apache SOAP library which is still floating around the internet — in the end I couldn’t find it without help — see http://stackoverflow.com/questions/9133160 ).

    How can I find this on searchco.de? There’s no way to search based on the filename (which I used to use on GCS with e.g. “file:org.apache.soap.rpc”). I tried searching for http://searchco.de/?q=%2Fpackage+org.apache.soap.rpc%2F&cs=on — but no match. It looks like you just haven’t indexed the code (it is pretty obscure), as the same approach works fine for other class searches: http://searchco.de/?q=%2Fpackage+org.apache.commons.lang%2F&cs=on.

    GCS used to hyperlink the imports in a Java file to go to the relevant classes in the same repos (or search globally if they were library imports), but that’s definitely a nice to have.

    I like what you’ve done. I’m definitely going to bookmark this and try it for a few weeks.

  4. Hi Susie,

    Thanks for your reply. I’ll keep an eye out for your update.

  5. Ben Boyter says:

    @Richard Bradley

    It seems that I still haven’t gotten around to indexing it yet. To point out however you can search on filename. You can add the following ext:java to any search term (outside the regex) and it will restrict to java extentions (or indeed pretty much any extention you can think of), EG http://searchco.de/?q=%2Fpackage+org.apache.soap.rpc%2F+ext%3Ajava&cs=on

    I still need to increase the size of the index. I have about 2 billion lines of code indexed thus far and I am adding live index support now at which point I will include any code I find as I go. This should allow the index to grow at a much faster rate then it currently is.

  6. Hi Ben,

    I was trying to look at the Sun SAAJ code, and couldn’t find it on search:

    http://searchco.de/?q=%2Fpackage+com.sun.xml.internal.messaging.saaj.soap%2F&cs=on

    However, a standard google search:

    http://www.google.co.uk/webhp?q=%22package%20com.sun.xml.internal.messaging.saaj.soap%22

    leads to:

    http://javasourcecode.org/html/open-source/jdk/jdk-6u23/com/sun/xml/internal/messaging/saaj/soap/MessageImpl.java.html

    Did I search wrongly with the first search? Or do you not have this code indexed yet?

    Thanks,

    Rich

  7. Ben Boyter says:

    @Richard Bradley

    I have modified the way this works since this post (sorry about how long its taken me to get back to you).

    http://searchco.de/?q=com.sun.xml.internal.messaging.saaj.soap&cs=on

    Shows at least a single match now. It would appear I just don’t have this code indexed still despite hitting about 4 billion lines of code. If you know where it lives let me know and I can go hunting. I would imagine because I have mainly sourced from github, bitbucket and codeplex that searchco.de will be lacking for older libraries.

    I don’t have the package keyword logic added yet either looking at it. Speaking of which how would you like that to work? Say I search for “package:linux malloc” should it search across all projects with Linux in the name or an exact match?

  8. > If you know where it lives let me know and I can go hunting.

    If you follow the grepcode link above, you can see where they claim to have scraped the code from: http://grepcode.com/snapshot/repository.grepcode.com/java/root/jdk/openjdk/7-b147/

    Most of the links on that page seem to be to grepcode’s copies of the code, rather than to the source (Google Code used to link to the source directly, which was nice).

    The only outbound link from that page is to http://openjdk.java.net/ — and on their homepage they have a link to an hg repository: http://hg.openjdk.java.net/jdk7/jdk7

    So it looks like you’ll need to hunt down open hg & git repos on the wider internet to catch examples like this: the big hosting sites like github, bitbucket etc don’t have everything. It’s a big task.

    > how would you like [the package keyword] to work?

    I’m happy with exact substring matches (like looking for “package com.foo.” in java files) and a “file” keyword for matching on filenames. I don’t know what a “package” keyword might do, so I probably wouldn’t use one.

  9. Ben Boyter says:

    Sorry about how long it takes to come back to this. I don’t seem to get notifications on posts.

    I will look into adding that soonish. Im working on the Apple OSX/iOS code at the moment. As you say I have been pulling lots of code from bitbucket/github/codeplex but don’t have everything. Im at about 100,000 repo’s at the moment (7 billion lines of code give or take a bit). I have started looking into gz/zip/tar files now but that’s still work in progress.

    I did add the package keyword some examples,

    http://searchco.de/?q=Linq+repo%3Aentityframework&cs=on
    http://searchco.de/?q=test+repo%3Alinux&cs=on

    It goes for fuzzy matching on the repo name (soundex based) so as long as you spell it correctly it should match what you are looking for. The ext syntax allows you to match on extensions presently EG,

    http://searchco.de/?q=test+ext%3Ajs&cs=on

    I will look into adding filenames. Im presently in the middle of adding more code, and re-factoring to provide a hybrid search experience (mixes documentation and examples where relvent). Its a hobby project so not sure how long this will take.


Leave a Reply

* Mandatory fields


4 × four =

Submit Comment