Showing posts with label opengrok. Show all posts
Showing posts with label opengrok. Show all posts

Tuesday, October 2, 2007

OpenSearch for OpenGrok

To speed up my searches on OpenGrok, I wrote a little OpenSearch descriptor. You know, that little technology that allows you to put any search engine in that little search box on IE7 and Firefox 2+. Just put the following XML on a file called opengrok.xml, on the root of the OpenGrok context of your servlet container:

<?xml version="1.0" encoding="UTF-8"?>
<opensearchdescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<shortname>OpenGrok</shortname>
<description>Search in OpenGrok</description>
<tags></tags>
<contact></contact>
<url template="http://YOUR_SERVER_HERE/source/search?q={searchTerms}&amp;start={startPage?}" type="text/html">
</opensearchdescription>

Change YOUR_SERVER_HERE to your actual OpenGrok server.

Then declare the descriptor in index.jsp's head (that's also on the root of the context), so it can be auto-discovered:

<link rel="search" href="opengrok.xml" type="application/opensearchdescription+xml" title="OpenGrok Search" />

And that's it, now Firefox and IE7 will offer you to add the new search plugin.

Have fun grokking your code ;-)

Oh, I should mention that there is also a specific Firefox toolbar extension for OpenGrok, but apparently it's incompatible with Firefox 2+...

EDIT 9/6/2009: This feature is now in OpenGrok's trunk so it will be part of the next release.

Sunday, September 30, 2007

Code search engines mini-review

A couple of weeks ago I got sick of searching our codebase with Total Commander. So I went googling for a code search engine. This is what I found:

  • cs2project: (open-source) developed by Simone as an academic project, using Lucene.Net to index. It's very basic as it's still a new project, but looks really promising. For some reason it only indexed 740 files and then stopped. I'll turn on logging later to see what happened...
  • Koders Pro: (commercial) led by Phil Haack, supports over 30 languages and provides lots of statistics. I installed the demo and after the indexing finished, I went browsing and searching and suddenly it asked me to get a (free) account on koders.com. Hmm, no thanks.
  • Krugle Enterprise: (commercial) seems cool, but I couldn't find a trial version.
  • Fisheye: (commercial) seems more repository-oriented than code-oriented. I mean, you can do full-text queries, but it doesn't give you the exact LoC where the query matched and it doesn't cross-reference classes and types. But when it comes to repository analysis, I think no other product has so many features. It even has a pseudo-SQL language called EyeQL to query the repository! Too bad the trial crashed while indexing our repository...
  • OpenGrok: (open-source) developed in Java, under the wing of OpenSolaris, OpenGrok uses Lucene to index source code. It's only about searching and doesn't offer statistics like the commercial products, but it's very good at what it does. It groks (parses) several languages, including C/C++,Java, Shell Scripts like ksh, bash, Perl, Makefiles, XML/HTML/SGML files, ELF files, Java class files, Java Jar files, archive files like TAR, GZip, BZip2, Zip files, man page formats like troff and more, but sadly, still no .NET languages. For the languages it groks, it provides cross-referencing of classes and types. And it gives you repository history search, too!

 

So I kept OpenGrok, and after installing and configuring, I announced it to the team. But our web designer (one of the coolest guys I have ever worked with) heard "OGrok" instead of OpenGrok (ogro means ogre in spanish). He went on calling it OGrok, and then he even put together an alternative logo, featuring the most famous ogre :-)

It has since become an invaluable tool for us, I can't recommend enough that you install one of these code search engines, it really improves collaboration with your teammates.