Hacker News new | ask | show | jobs
by mikepurvis 2331 days ago
Another great option for local code/repo search is Hound. I maintain an instance of it at my workplace, but it's so lightweight and easy to deploy that I could easily imagine running an instance of it on my laptop for offline personal use.

https://github.com/hound-search/hound

2 comments

YES! We have been using hound for several years now, having all hundreds of our org repos searchable in one spot, in a LIGHTNING FAST manner has been an invaluable tool to help our various teams keep up with the legacy sprawl and effectively remove old features and all their dependencies from our sprawly systems. I even wrote a microservice that uses gitlab global hooks to keep hound up to date without polling, and a little c# config generator that runs as a cron job on our gitlab instance and redeploys hound with the newest repos included.

Hound falls short on access control front (we wrapped our instance with a saml proxy), but it's still a 'you either can search every piece of software for \'password\'' or you don't have any access at all. Having to index a specific branch instead of all of them kinda stinks too; for those two specific reasons we have been eyeing sourcegraph, esp. as the gitlab integration matures.

I can't emphasize enough how fast hound is and how pleasurable it is having a regex based code search that doesn't make me wait.

Yeah, the access control thing is not ideal— I have my instance behind Apache for the active directory plugin. Potentially as a hack you could run multiple Hound instances and reverse proxy the correct one based on a user's role? Might be easier to just add in proper support upstream. :)

Anyway, for now I'm at a small enough org that everyone still just sees everything, and it's been super valuable.

As far as competition with other tools, the infrastructure team at my org has their Elastic instance plugged into our GitLab, but most of the engineers agree that Hound is better— it's faster, it does regex, and it doesn't do goofy stuff like return pages of the same result from everyone's fork of the same repo.

A similar but more structured (though perhaps Hound supports a similar feature set) code searching tool is OpenGrok [1]. It's a bit more setup as it uses Apache Tomcat, but once it is setup it has an incredibly fast and useful code querying tool with really useful abilities to x-ref functions/structures, highlight uses of variables, and integrates git info as well. If you've ever used elixir.bootlin.com to go through the Linux source code, opengrok is effectively a more feature packed open source version of that. I highly recommend taking a look to anyone who spends a lot of time digging through code.

[1] https://oracle.github.io/opengrok/