🍵️

2021-09-24

Simple Search Script on My Blog/Gemlog

Wow, third post today.

Anyway. I had some time to spare tonight and decided to implement a simple search thing for my blog/gemlog. I already had a cgi script that did basically the same thing for a personal tool, and porting it for the blog and then making a gemini version was fairly simple.

It's probably the dumbest search possible, and will become slower and slower as I write more posts, but it's better than nothing. It takes the search string, splits it on spaces, and runs a few iterations of grep through all my posts. Then it lists, in no specific order, all posts containing strings that match all search terms, case insensitive. That means that a search for "decent" will give results containing "Decentralised", and so on and so forth.

By the way, it doesn't care if it happens to be a markup string. Try searching "<h1>" or "=>" and watch it give you all posts 🤪️

I wrote it in bash. Now a bunch of you will go "Oh! Let's try some Bobby Tables strings!". It's properly implemented, however, so no luck there.

The hard part is figuring out where to place a search bar or link! On my front page is good for now, I guess.

Links

XKCD "Exploits of a Mom" aka Little Bobby Tables.

Blog search.

Gemlog search.

-- CC0 Björn Wärmedal