September 2007 - Posts

CS2 - a personal source code search engine

As I blogged some time ago I have been developing a source code search engine called CS2. I completed it lately and, although it's not as feature-rich as others - say, Koders Pro Edition - it works pretty fine and suites the needs of whomever needs to search through code stored on its machine. Actually, it's neither as heavy as Koders Pro as well, and plus it's free and open source.

It works as an ASP.NET 2.0 website and lets you request indexing folders and singular files, as well as search through them with a simple syntax. By default searches are performed in full-text fashion, but you can restrict queries on particular fields. The syntax is documented in the website. It's multithreaded so indexing and searches can occur at the same time.

It can be customized using the Properties.config file in the Configuration directory, by setting the folder where the files of the index are stored as well as the update interval. It's capable of automatically removing from the index files which no longer exist on the file system as well as update those which have been edited.

At the moment it can parse and index only C# source code but it's written upon Windsor inversion of control container and can be easily extended just by adding a new parser. If anyone's interested I will post about the complete process of adding a new parser.

To get started just download the zipped website from the project homepage and run it. Then type the path of a folder containing C# source code files on your machine in the corresponding input field and wait some time for the indexing process to complete (you won't see the progress since it occurs on another thread so that you can perform searches concurrently with indexing). Its duration depends upon the number of files to be parsed and indexed. Once indexing is complete updating the page shows the number of documents the index contains. Click on the link on the upper-right edge of the page to show the search syntax.

kick it on

New SQLite provider for ELMAH

I bet you know what ELMAH is, don't you? ELMAH stands for Error Logging Modules and Handlers, and its main and only purpose is to log exceptions occurring in ASP.NET web applications, within which it integrates with just a couple of entries in the Web.config file. It's got a lot of documentation and it's open source, so for any additional information check out its website.

Until yesterday it let you log exceptions in memory, on xml files and SQL Server, but a highly requested feature was to use SQLite as a backing store. Although I didn't know SQLite much it has a cool .NET wrapper published on Sourceforge which exposes its features to the managed world, so I took on the reported feature request and implemented it. SQLite doesn't offer all of the features provided by SQL Server, but it's almost completely SQL92 compliant so it has all that's needed, and much more.

So why to use SQLite instead of SQL Server or xml files? SQLite is a relational database engine, so it's much faster than xml files, and compared with SQL Server at the moment our tests didn't show any performance penalty; plus, it's free! Paging through about 15.000 stored exceptions via ELMAH user interface resulted to be lightning fast!

Since SQLite syntax isn't widely documented, if anyone's interested I will blog about it and the steps I went through to integrate it with ELMAH. Otherwise, the source code is available on ELMAH Subversion repository.

kick it on

This site



This Blog




  • MaximumASP