Search your code and asset archives? Well, why not…

Written By:
Content Copyright © 2014 Bloor. All Rights Reserved.
Also posted on: The Norfolk Punt

A configuration management assetbase can contain an awful lot of information, but finding it in an ad-hoc search can be tricky. Some of it (quite a lot of it in fact) might be sourcecode, written in a language that is almost, but not quite, exactly like English; some of it might be word-processor documents; some may be scans of, say, signed paper contracts; some might be graphics assets, such as an avatar in a computer game. Finding everywhere that, say, Frodo, is mentioned, from a digital license agreement to an error message—perhaps in response to legal action—can be decidedly non-trivial.

Except, perhaps, Perforce’s new acceptance of OSS can come to the rescue (if you are lucky enough to be using Perforce) with p4-search—although I really wonder if it can find a Frodo-like avatar image amidst a lot of source code… Well, it can if the requisite metadata is present—it searches keywords, strings or phrases of interest, although, as it is OSS, I suppose someone could always add an image search capability (“find all images with humanoid form, without shoes and with hair on toes”—but I’d expect lots of false positives).

More seriously, p4-search is built with Apache Lucene’s Solr technology, and Perforce claims that it is fast enough for real-time use on large (multi-terabyte) repositories. It is also security-aware and enforces Perforce security policies, so only information that the user is authorised to access is retrieved. p4-search ships with fully documented RESTful APIs, so search results can be embedded in home-grown applications. There are also rich search options; searches can be limited to specific depots or depot paths; last creator or last editor of an asset; and time created. p4-search can search all versions of a file or just the most recent, skip certain file types, index only metadata, and so on—power users can even leverage Solr’s custom query syntax for Lucene indexes.

A useful search utility, then, one that can help developers manage their assetbase; and a good example of how OSS can complement a commercial software model.