Shared publicly  - 
Google turned off Code Search earlier this week. Creating and launching the initial public version of Code Search was my first project at Google, and, like many programmers, I'll miss it.

To mark the occasion, I have posted at an explanation of how Code Search worked, and at a set of command-line tools to run regular expression searches against large amounts of code, quickly. It's obviously not a complete replacement, but it's the core of what Code Search did, and now you can run it on your own machine.

I want to thank everyone at Google who worked on or supported Code Search over the past five years. There are too many to name individually, but it was truly a team effort and a lot of fun.

P.S. Perhaps the best picture of source code ever published:
Regular Expression Matching with a Trigram Index or. How Google Code Search Worked. Russ Cox January 2012. Introduction. In the summer of 2006, I was lucky enough to be an intern at Goo...
John Atten's profile photoAram Hăvărneanu's profile photoDaria Brashear's profile photoSusie Bily's profile photo
How Ah
RIP. I loved code search!
That was a fun launch, I really enjoyed working on it with you. I still laugh about that SFGate image -- searching the source code of jpegs was clearly a feature we missed. =)
There doesn't appear to be any code in the repository yet.
Such a shame for everyone, plus it was always handy being able to add "Russ Cox, you know, the guy that wrote Google Code search" in a forum
I already miss it; I saw it this morning -- before seeing your post here -- while trying to find something in appengine java libraries; i'm still looking :(
Thank you very much for working on code search and Google for hosting it over the years. This was an extremely valuable resource for all sorts of coding tasks. Be it complex algorithm search or simply comparing quantities of common variable name uses. I'll sorely miss it for my private hacking but even more so in our company for our day to day work. We would have loved to see a community sponsoring program started that'd have allowed individuals and companies who value code search to contribute money for keeping its hosting alive.
The move to shut down Code Search will do more damage to Google's reputation among programmers than almost anything else I can think of. Very sad.
Fun related tool I just learned about. Qgrep zips up your source tree and then runs a multithreaded decompress+RE2-grep over the zip file. The reduced I/O more than compensates for the decompression time. Csearch will probably do even less I/O, but still, very cool use of RE2.
are we going to be seeing `go grep` anytime soon? :)
Thanks so very much for your incredibly informative post! As a self-taught developer, I have avoided Regular Expressions like the plague until only recently, when a business need forced me to face my fears. Naturally, as with most things, the reality was not nearly as bad as I imagined.

Your article and examples have provided a first-class foundation for a much deeper understanding. Those of us having to learn on our own are often faced with navigating our way from the top down, starting with gluing together highly abstracted "frameworks" and libraries, and only arrive at the "Science" part of programming after much stuggle with the higher levels of abstraction. From there, even with the help of search tools and the massive amount of information (or possible because of the overload) it can be challenging to know where to start in seeking the lower-levels of understanding.

Kudos, and nice work!
Thanks Russ, both for the informative article and for the excellent software.

One might find the following .profile excerpt useful:

cs is a shorter name for csearch, I set up line numbers by default so I can right click on results in acme. It prints relative paths instead of full paths.

csh is code search here, effectively cs -f `pwd`.

I also run cindex at shell startup, to keep it up to date at all times, it runs in the background so it doesn't slow a new shell.

Edit it as required, have fun.
Hi guys. We're upgrading in the next few months in the hopes that it is a good alternative to the google code search. At that time, we'll be using the ohloh project list (with code enlistments)... let me know your thoughts!
qgrep appears to be MIA, but that's an interesting idea.
Add a comment...