Source code search engines

Lazy people like me are often looking for re-usable components and libraries to do the hard work for them. While a combination of Google, Freshmeat and Sourceforge usually gets the job done, the process can be made much more painless with a dedicated source code search engine.

The very first search engine that I ran into was [[|]]. I haven’t used it very much, but it looks pretty cool. Searching for “java hash map” will return a list of Java files having a map or a hashmap, //and// show the relevant code snippet for context. Each search result also has links to the corresponding project and the source file.

//Edit: I had written up a whole bunch when I accidentally pressed Ctrl-W and closed the window. Dang! Can’t wait for some drafts like feature in WordPress.//

A new entrant in this arena is [[|]]. You can think of it as the Web 2.0 version of Krugle is not open to the public yet, so I couldn’t test it out. You cn get some idea of the functionality by [[|looking at the screenshots]]. Functionally, I can’t find too many differentiating features, the one exception being the ability to save/share searches.

Finally, there is [[|Gonzui]] — its essentially a desktop version of source code search engines. So instead of going to some website, you just download and run Gonzui on your own. Seems to be a waste of resources, but the advantage is that you can customize and filter the projects you actually want to search in. This might be particularly useful if you need to frequently search code of a small number of projects. But then why wouldn’t I use something like cscope/ctags instead?

It seems like the [[|Ruby Application Archive]] is using Gonzui to provide a [[|search interface]] for projects it hosts/lists. I guess thats one way to use Gonzui, specially if RAA denies services like Koders or Krugle the right to index their code. Though given that a lot of this code is freely downloadable, it doesn’t seem likely its possible to do that legally.

Leave a Reply