May 28, 2014

Saving My Bacon With P4Search

Version Control

Image: ZT Jackson via Flickr

If you're a Perforce user then there is a pretty good chance your server has a virtual mountain of files in it, especially if you are believer in Version Everything. Here at Perforce our server has been up for 18 years and contains very nearly every file we've ever generated; source code, art assets for the web site, all the third party code we are dependent on, and even many of the recipes from our annual potluck. It's fairly well organized, but with that much content sometimes finding something is akin to finding a needle in a haystack. Actually, it's more like finding a needle in Nebraska.

Thankfully we have something to help find those missing proverbial needles now. P4Search is a Solr-powered search tool that makes it a piece of cake to search the content in your Perforce environment. Here are a few times it recently saved my bacon.

"Where the hell did that message come from?"

We had a very weird error message come in from a customer. The support team had searched the product code and not found anything that matched up with it. Being a daily user of P4Search I tossed the error message into it and came up with one match: a random Boost library that we make little use of. That Boost file is stored in Perforce, but in an area no one would normally check. Because P4Search makes searches fast and efficient, I could scan through parts of the depot I'd never look at using either 'grep' or 'p4 grep'.

"How do I even use this method?"

There was a P4Java issue that popped up on the forums that referenced a method I wasn't familiar with. Java projects can have some pretty crazy file hierarchies and I wasn't sure where to even look for this method. A quick search in P4Search brought up all the places the method was defined and used. I realized that an example of it being used was all I needed, so I filtered my search by depot path to restrict the search to a project that I knew used the method. A quick click took me to Swarm and I had everything I needed.

"What else went in that cocktail?"

I decided it was time for a spontaneous cocktail party on the patio at work, but couldn't remember what I like to put in my Normandie cocktail. Thankfully P4Search can index a number of different file formats, so a quick search brought up the docx file with my recipe from Thanksgiving. A single click took me straight into our Commons recipe space so I could look at the file without having to grab a copy.

"Where did that article go?"

Recently a blog post for an upcoming product announcement had gone missing; versioning everything doesn't always mean versioning everything in a sane place. I knew the topic and the author's name, so I popped those into P4Search, and used the advanced tab to search for files changed in Perforce by the author with the product name somewhere in there. The document was the top link returned.

Suffice it to say, being able to find files quickly is hugely useful and a massive time saver. P4Search is completely free and can be downloaded from our site. It also integrates into Commons and Piper, our open source Perforce client for artists and designers for the Mac. Take it for a spin and let us know how it saves your bacon!