Content Manager: Search

When I first took a notion to write a new content manager in Scheme, I had a lot of ambitious design goals. It was to be neither a blog nor a wiki entirely, but a tincture of the two with the characteristic that the website would have different sections, and that each section could have aspects of its functionality tailored to its purpose. A project section could behave like a wiki, so that users of my programs could come and contribute their tips. A blog section would have author-editing only (and maybe I can rig up a comments system?), and it all had to work with a git backend. That this content manager would support searching was a given, yet I really had no idea how to go about writing a search function.

The content manager is progressing slowly now, and still progressing toward those original goals, but sometimes they seem farther off than I originally expected. I have become less certain that I will ever even reach all of those goals because of the sheer complexity of just writing the basic foundation. Difficult questions have come up every step of the way with the design of this über-CMS. Contrast this with my project mowedline, which in my recent spate of work seemed to go as easily as snapping together Lego bricks.

A pleasant surprise is that I did manage to put together a search mechanism, and sooner than I expected by far. Sometimes the preconceptions we bring to our work can be inhibitors. We think a thing will be complex and difficult, so we treat it as a black box and never approach it. This was me toward the search feature. I envisioned having to recurse through the whole file tree, parsing content with complex search algorithms, imagined that this method would be far too slow, and would be like having opened a Pandora's box of complexity, of trying to gain efficiency through caching and who knows what else, building an elaborate search system that would ultimately spoil the original simplicity of using a VCS backend.

Then I had an "a-ha" moment, or maybe it was really an "oh, yeah" moment. Oh, yeah, I'm using git. I have git grep. With this realization, I was able to complete a basic search mechanism in one evening (and a little into the night). Sure, it needs work, but the basic code is in place, and I'm pleased. So there, a little ray of hope shines on the content manager project. Maybe I will reach those far-off goals, just need a little effort and inspiration.