CSearch is a simple source code search engine. It is intended to help programmers in a small to medium sized organization maintain an overview over and reuse parts of the various software projects within the organization.
- a command line tool that scans through a predefined set of software projects while building an index of the code
- a small CherryPy based web interface through which one can search for words or regular expressions in the code that has been indexed.
This tool uses the free Plex tool written by Greg Ewing. See further details at http://www.cosc.canterbury.ac.nz/greg.ewing/python/Plex
Parts of this code is based on example code from "Programming Collective Intelligence" by Toby Segaran. Copyright 2007 Toby Segaran, 978-0-596-52932-1.
Thanks to Jeppe Brønsted <email@example.com> for writing the incremental search web frontend (e.g. the files in the static dir).
Before using CSearch you first have to install the 3rd party packages listed in the Requirements section below. Then simply run
python setup.py install
As default CSearch will store the index, configuration files, etc. in [sys.prefix]/csearch. On *nix systems this would typically amount to /usr/csearch. On Windows it would be something like C:Python25csearch.
It will also install some scripts, namely
csearch-index.py - the CSearch indexing tool csearch-search.py - the CSearch command line search tool csearch-server.py - the CSearch web server
On *nix systems they will typically go into /usr/bin and on Windows you'll find them at e.g. C:Python25Scripts.
To index you first have to edit the project.xml file located in the folder described above. When you have edited the project.xml file, you can run
This will build an index in the file
You can then edit the server configuration file csearch.conf and start the web server with
If you e.g. set
host = 127.0.0.1 port = 8080
in the csearch.conf file and start the web server with the command above, a basic web frontend will be available at
and a nice incremential frontend will be available at
The CSearch indexer and web server theese 3rd party packages to run
- Python 2.5+
- BeautifulSoup (http://www.crummy.com/software/BeautifulSoup)
- SVN client (if you want to index svn repositories)
- Mercurial client (if you want to index Mercurial repositories)
- ssh + rsync (if you want to index remote file systems)
- CherryPy (if you want to use the web server)
Other source code indexers
Comments, suggestions, etc. are welcome. Send an email to firstname.lastname@example.org.
- Version 0.1, 2009-05-11
- Basic search and index functionality
- Simple web-based search
- Search via regular expressions
- Incremental web-based search
- Index local and remote filesystems via ssh
- Index svn projects
- Version 0.2
- Index Mercurial repositories
- Ignore files and/or dirs with exclude tags