Searching source code on Koders.com
Lately Phil Haack has blogged about his new job at Koders.com. As far as I can see they provide a search engine for open source code and let people submit their repositories so that their code can be indexed.
I've developed some interest in code searching since I'm going to implement a code search engine for my Information Retrieval course here in Italy, and hope Phil will give me some ideas in his future blog posts about Koders. In fact, I'm going to use Lucene.NET for indexing the source files - which I think they are using, too - and maybe I can learn some good practices and get some tips from them.
Though it doesn't have a slick interface as Krugle, Koders provides a service for querying its engine from the web, returning the search results as RSS, so I thought I could write a wrapper on top of it. I've come up with a fluent interface query class based on strongly typed classes generated with the ASP.NET RSS Toolkit.
Koders service allows refining search results by programming language, license, logical placement of the code in the source file (class name, method name, interface name) and by file name.
In the wrapper I created the querying is a two-step process. First you need to create a KodersQuery class supplying the parameters of the search, then you use one of the strongly typed classes generated by the ASP.NET RSS Toolkit to load and parse the results:
KodersQuery q = new KodersQuery()
KodersRss rss = KodersRss.Load(q);
The KodersRss class wraps the xml returned by the query and provides the items found via the KodersRss.Channel.Items property.
Given the profileration of LINQ to X implementations it would be cool to create such an API for search source code, either on Google Code Search or Koders, but I'm still waiting for the final bits of LINQ before to attempt doing it. In fact I've seen the source code of some LINQ to X libraries and it looks like they won't compile with Orcas if they were created with the May CTP.
At the moment the source code is on my svn repository.