Source: I originally found a smaller version of this picture on Kelly Blue Book, but after reverse image searching, I found this higher-resolution version on Coches.

Here we are, item numero dos in our three-part mini-series about my recent (and highly suspect) purchases. Without further ado, here we go.


For some reason I'm not sure I understand yet, I bought a car.

As Fate Would Have It

I didn't just wake up one day (after living here for three years) and decide I wanted a car. No, I bought it on a whim when the opportunity presented itself. A co-worker was selling their car, and it just happened to check all of my boxes:

  • Cheap. The co-worker only wanted $2,000 for it, even though Kelley Blue Book put it closer to $3,500.
  • Stick Shift. I'd always wanted a manual transmission car. I had learned once when I worked at the bus company, but I was never good at it, which I'm going to blame on a lack of practice rather than a lack of ability.
  • Great Shape. Despite being 14 years old, the car only had ~86,000 miles on it. Plus, my co-worker was the sole owner of the car for its whole life, and it wasn't the car they learned to drive stick on. They had also meticulously documented (with receipts) all the work they had done to it.
  • Ugly. In and of itself, the 2004 Honda Civic is a fine looking car, as far as sedans from the early 2000s go. This particular Honda Civic is a bit…unsightly. The clear coat is coming off, one of the doors is missing a handle, and the interior is covered in a fine layer of Cheerio dust (my co-worker has two small children).

On top of all of those things, the financials happened to line up too. Normally, I don't keep more than $1,000-$2,000 in my checking account, because I invest my paychecks as they come in. I do this explicitly to disincentivize myself from doing exactly what I did. But on this particular week, I happened to have some extra cash in my checking account, preparing for Questionable Purchase #3. Oooh, foreshadowing!

I took this picture in a Panera parking lot, because I'm a classy lady.

I haven't yet decided if this purchase is run-of-the-mill dumb, or next-level, pants-on-head dumb, but as a dude who prides himself on keeping things simple, it definitely seems like an indefensible decision. Strap in though, because I'm going to attempt to defend it.

Deprecating the Truck

I spend a lot of words saying mean things about the truck: how it's a screaming metal death trap, how it'll explode any day now, how (intentionally) hideous and inhospitable it is, how I spend as much time as a I can away from it, you know the deal. And it's all true, every word of it. I bought the truck for a singular purpose: sleeping.(and also storing my stuff, but let's not nitpick)

Sure, the truck is great for moving things, but aside from that, I really would prefer to never be driving it, for a whole host of reasons I've rambled about at length. But there really are times when I do need to drive, which I'll enumerate in painstaking detail now.

Times I've Needed a Car

That time the truck battery died

Okay, so it turns out I could only think of a single situation where I absolutely positively needed a car, and it was the time I accidentally killed by battery. Turns out, if you start a vehicle and immediately turn it off again, the alternator doesn't have time to replace the charge used to turn the engine over. You might do this, for example, if you were just inching forward into a slightly better parking space. Further, if you (unwisely) did this several times over the course of a few weeks, with no other driving in between, that would definitely kill the battery. This is what I did. Don't do it, it's no fun.

But anyway, to get a replacement battery, I had to rent a car, no two ways around it. Lugging a 50 pound battery in and out of a Lyft, while probably hilarious and a fun story, wasn't how I wanted to spend my Saturday.

Times I've Wanted a Car

The fact that I could only think of a single occasion where I truly needed a car seems to suggest I really shouldn't have purchased one. But, just for funsies, let's look at all the times I've wanted to have a car.

That time I went on a date

Who am I kidding, I don't go on dates.

But in a hypothetical world where I did go on dates, I don't think it'd be unreasonable to want to be able to pick up my date in a vehicle that isn't a five-ton box-house death-machine. Sure, I could just rent a fancy car (on Turo or Getaround) for dates, but that doesn't sound particularly sustainable. Also, I'd like to think my ego isn't actually that fragile.

Literally any time I've driven the truck and wasn't hauling something

One of the reasons I decided to live in a truck was because there's so much cool stuff to do in the Bay Area. Why would I want to be at my boring old apartment when I can be out in a world full of new and interesting experiences? Sometimes, those experiences necessitate driving, either because they're too far to bike, or don't align with the public transit schedules. Historically for those cases, I've had three four options, roughly ordered from least terrible to most terrible:

  1. Hope someone else can drive. This requires depending on other people, and means I can't really make the plans, which limits my flexibility. Plus, it means no solo trips, and I quite enjoy my alone time.
  2. Rent a car. I've done this a couple times, to go to concerts in San Francisco or to go to Monterey, for example. Again though, this isn't particularly sustainable, especially if I want to do it every week or two. Plus, then you have to juggle the logistics of picking up and dropping off the rental car.
  3. Just don't go. I could always just pass on whatever opportunity has presented itself, but where's the fun in that?
  4. Drive the truck. Hard pass. Between gas, parking, and tossing my furniture into the air every time I hit a pothole, the truck is by far the worst option.

Obviously, none of these are ideal, so having my own dedicated vehicle makes a lot of sense here. Still, I managed to get by three years without one, so I need to make sure I'm using it the right way.

Ground Rules

As far as having a car goes, I think the one I got is pretty in-line with the rest of my life. It's in good shape, it's not flashy, it's pretty unsightly, and it's practical. Having a car represents a pretty dramatic shift in the way I can do things, so to make sure I'm using it in a way that's consistent with my own goals, I've set up some pretty basic guidelines.

  1. If I can bike, do it. My last major purchase was a bike, and I intentionally got a nice one to disincentivize myself from driving. That way, I'm more likely to bike because I legitimately enjoy it more.
  2. If I can take public transit, do it. I didn't get a car for convenience, I got it for when it makes sense. If I'm just going to the city for the day, biking + public transit will always be a better and more exciting option.

Final Thoughts

I'm still getting used to having a car. In particular, now I have to juggle the car and the truck and my bike, and I've actually struggled quite a bit trying to find a reasonable flow that makes all of them accessible when I need them. I'll save those stories for another post though.

As a closing note: I'm frantically finishing this post before I catch a flight to start a ten-day trip in Israel, so the reveal of Questionable Purchase #3 will have to wait until I return.


Source: My sexy new steed, under ideal lighting conditions.

I'm generally not against spending money. I am however generally against buying things. This is a point I've surely beaten well beyond death by now, so I won't belabor it much further. It's just to say that I want to be really sure something makes sense within the larger context of my life before I buy it and have to deal with it forever.

I only mention this because I've been on a bit of a purchasing spree (by my standards) as of late, which is at least part of the reason I've been so quiet on here for the past two months. The other part of the reason is that I'm just generally bad at blogging. Anyway, this post (and the next two), will talk about some of the purchases I've made, mostly over the past few weeks. This first one's not all that contentious, but I promise they'll get more questionable as we go. Okay, on to the post.


I have a fairly limited range of hobbies. I like reading, hiking, writing the occasional blog post , making low-quality gag websites for my own amusement, and last but not least, biking.

My love of biking isn't new, I've definitely mentioned it once or twice. Even though I was a total biking rookie three short years ago, some of my favorite memories since moving out to California have been biking up and down the Bay Trail on my trusty steed, a used Raleigh Misceo I haggled my way into purchasing. Alas, the bike is showing its age and last year was deemed financially unwise to repair.

Nowadays, riding the bike (even at the slowest of speeds on the smoothest and flattest of surfaces) feels like riding an exercise bike covered in molasses, with the resistance cranked up to 11. With my sore, lactic acid-filled quads in mind, I decided that the bike and I would embark on one last hurrah, a figurative ride into the sunset: Bike to Work Day 2018, henceforth just called "BTWD", because bandwidth ain't free. My company is big on BTWD, so I figured I'd Caltrain up to San Francisco and join tons of my SF-based co-workers for the ~42 mile ride to work in the morning.

But alas, it wasn't meant to be.

Tragedy Strikes

The weekend prior to BTWD, my favorite mode of transportation was stolen from me. Err, the front wheel was stolen while the bike was locked up at a Caltrain station. The back wheel of the bike was also removed, but whoever removed it realized that wasn't even worth stealing, and they left it next to the bike. The rear derailleur was also in rough shape from being on the ground; I don't imagine it was placed particularly gingerly.

I feel a bit guilty for this, but I'd semi-secretly been rooting for it to be stolen, and I was almost happy to find the bike in such a sorry state. After all, it gave me an excuse to jump start my search for a new one. In and of itself, that bothered me a little bit. I guess it's just frustrating how something that means so little to me (a bike tire) can mean so much to someone else, to the point they'd take the risk of stealing it. This is probably a good time to plug GiveDirectly and HandUp, organizations that give money directly to people in need. If you've ever felt overwhelmed with how lucky you've gotten in life/how good your life is, they're both wonderful organizations to contribute to.

Brief tangent aside, with BTWD right around the corner, it wasn't a great time to have my bike in an unusable state. Luckily for me, my employer provides a borderline sickening bevy of useful perks, one of which is doling out commuter bikes to anyone who wants one. So I borrowed a beat-up commuter bike, and did the ~42 mile ride.

I hadn't done a long (>20 mile) ride in a while, partly because it had been colder than usual and partly because I'd been lazier than usual, but I got to say, I thoroughly enjoyed the ride from SF down to South Bay. The weather was gorgeous, the ride was the right amount of challenging, and best of all, I got to stuff my unremitting maw with more food than usual.

Bike 3.0

Still coming down from my BTWD-induced high, I started my search for a new bike almost immediately. My thought was that, with a few years of bike riding experience under my belt, and plans to do a century (100+ mile bike ride) one of these days, I shouldn't be afraid to spend a bit more on a nice road bike that will likely last me a decade or so with proper care. After doing a bit of research, and learning even the most basic of cycling lingo, I eventually settled on the entry-level Specialized Allez, coming in at a pricey, (but not bank-breaking) $750. It's got an aluminum frame, carbon fiber fork, Shimano Claris shifters, and many other fancy-sounding features I can vaguely pronounce and even more vaguely understand.

I tried out some of the more premium bike configurations, even testing out a $2,800 Specialized Roubaix Elite. In the end though, I couldn't really justify a bike that is almost four times the cost and only a few pounds lighter and a few percent faster. I used a corporate discount to get 15% off the bike as store credit, which I used to buy a new lock, seat bag, and replacement tube kit. The seat bag and replacement tube kit were promptly stolen two days later while biking around San Francisco. Such is life.

My sexy steed, sans stolen seat sack, under less-attractive office lighting.

Reflecting

In the context of my life, this purchase probably made sense. Sure, I could have fixed up my old bike, replacing the derailleur and the front tire, but the rest of the bike was in such bad shape that I'd really just have been prolonging its misery, and my own. Through that lens, treating this purchase like an investment in my cycling-heavy future seems like a reasonable bet. The jury is still out on whether that's true for Questionable Purchases™ 2 and 3.


The future scares me.

Not in a "the icecaps are melting" sense,* more of a "what am I doing with my life" sense.

I spend a lot of my words on this blog talking about the future. Saving for it. Planning for it. Picking travel destinations.

So imagine my surprise when I sat down one day to think about it, and I found that I had no idea what I actually wanted to do with my life.

Looking over my past posts, the plan seems pretty clear:

  1. Live in truck.
  2. Save money.
  3. "Retire" young and travel the world.

A painfully naive snippet from a year and a half ago captures it really well:

[My] next home will ideally be nothing more than a backpack. I'll hop around the world as passports and seasons and retirement monies allow, staying in hostels and exploring the places that words in my travel books couldn't possibly do justice.


Notice anything missing there? Like, for example, literally anyone else in my life. My friends? My family? I didn't leave a ton of room for other permanent human beings in my plans.

I don't think I was intentionally being selfish with my plans, I just think I have a tendency to idealize and romanticize, especially when I'm writing for the blog. This blog is focused on a specific (and relatively small) piece of my life, so it paints a skewed picture. I like things to be simple and clean and my ideals reflected that, to a fault. The idea of perpetual travel might make for pithy poetry, but it's not practical.

Do I want to travel? Of course I do. Every opportunity I've had so far has been an absolute blast, and I'm better off for having done each trip. But there need to be limits, there needs to be flexibility. There are big life questions that don't get answered when the plan is just "travel perpetually". Things like, "how do I take care of my aging parents?" or "what if I want to have a family, or kids?"

I didn't start thinking about these things until a series of depressing life events (some my fault, others not) made me start to question my own mortality. Sure, in the grand scheme of things I'm pretty young, but I'd be foolish to pretend I'm not getting older. It's been nearly three years since I moved to California, and it almost hurts to think about how fast that time has gone by. One of my biggest fears was complacently watching my life pass me by. I thought the truck would save me from it, keep me on my toes, but the time passed all the same. Not much has changed in those three years: I've learned a bit, I've earned a bit, and I've been a few places, but I'm fundamentally the same Brandon I was three years ago. Same truck, same routine, different year.

So, what do I do now? Well, I try to sort it all out. I sit down in a quiet room and I take a lot of deep breaths. Or I hop on my bike and ride slowly along an empty trail. I go through the same process that led me to buy the truck. I think about what matters to me and who matters to me. I think about where my priorities lie, and what happens when they conflict. I think about the things I think I want, and the things I know I don't.

And I realize that I do want to be there for my family, and at some point, I'll have to move somewhere closer to them. I realize that I do want to share my life with someone, and maybe we'll want tiny genetic hybrids running amok someday. I realize that these things don't necessarily fit in with retiring early, and I'm okay with that. It's not a race, and working for a few more years for what I care about isn't a big deal.

I'm not really sure what the purpose of this post is.
Maybe just to un-skew the proverbial picture a little bit.

*Though I find our planetary prospects pretty petrifying too.


Source: Originally, I was going to use a picture of a 2018 Ford E350 box truck, but then I decided that was dumb. Plus, the black and white graphics look cleaner and load faster.

This may not be my first post of 2018 (or even my second, for that matter), but hey, better late than never.

Happy 2018!

I've said before that I'm not a big fan of New Years' resolutions. That's still true. But I am a fan of taking the time to evaluate how my life is going, and course-correcting as necessary. I try to do it every few months, but the start of a year is as good a time as any to take a good hard look in the mirror, so let's do it.

Metrics for Success

I feel like it'd be cheating to just say, "yeah, I think things are going well", and call it a day year. I think it's important to figure out what it means for things to be good, and that's going to be different for everyone. For me, things are good when some combination of the following things (in no particular order) are true:

  • I'm learning new things
  • I'm lifting heavier objects
  • I'm closer to financial independence
  • I'm getting my beauty sleep
  • My friends and family are doing good, by their own metrics

With some criteria in mind, let's break it down and see if things are, indeed, good.

Learning New Things

2017 was a good year for learning new things. I learned how to snowboard (badly), do stand-up comedy (poorly), and dance like Beyoncé (abysmally). And no, I will not post videos of me doing any of those things, but here are some pictures (except for the Beyoncé dance class, because I don't need that kind of blackmail material out on the open internet):

Not pictured: (left) me involuntarily headbutting the mountain, and (right) a stone-faced audience cringing in silent, abject horror as I laugh hysterically at my own bad jokes.

I'm a big fan of doing things ever-so-slightly outside my comfort zone, because I think that's where the real learning and growing happens. And that's pretty much how I ended up in comedy and dance classes, by taking double-dog dares from my friends.

Outside of half-assing new skills, I spent some time full-assing a few existing skills. I bought a Kindle and read more books than in past years, and learned about different areas of computing, like how to correctly use Docker, properly deploy stuff on Google Cloud Platform, write games in Unity, and build modern single-page applications (which I mentioned recently). I'm hoping they'll prove useful in future endeavors.

Lifting Heavier Objects

In my list above, I said that things are good when I'm lifting heavier objects, but I probably should have phrased it as "I'm lifting heavier objects, and my feet take me farther, faster", but that's a lot of words and it didn't fit the pattern I was going for.

If you search the blog for the word "cardio", pretty much all of the references are talking about how bad I am at it. Growing up, my doctor said I had "sports-induced asthma", which is fancy doctorspeak for saying I was "exceptionally unathletic". I'm happy to report I do real cardio now…for various values of "real". I ran my first 5k in November, at an 8:25 pace. Yes, I did spend a few minutes at the finish line dry heaving, but we can definitely gloss over that detail.

I don't have any pictures, because the company who did the marathon photos wanted like $20 for a digital download, which is downright thievery. Like, I understand you need to maintain the site and set up the cameras and win contracts, but why on earth would I shell out $20 for a high-resolution print of myself on the verge of tossing my cookies?

As for heavy objects, my ability to pick them up and put them down actually declined in 2017. Like, January Brandon would beat December Brandon in a whole gamut of strength-related activities, and probably a fight, if for some reason it came down to that. I cut meat out of my diet early last year, and even though I was being careful with my macronutrients, I still lost somewhere between 15%-20% of my overall strength while my body adjusted (I used to subsist almost exclusively on chicken, for better or worse). I also did a lot of travelling in the first half of the year, which means I wasn't as consistent with my routine. I've gotten most of my strength back, and I'm also a few pounds lighter, so my Wilks Coefficient has probably improved, but there's still plenty of work to be done if I ever want to hit my combined lift (squat, bench, deadlift) goal of 1,000 pounds.

Closer To Financial Independence

One would think that this should be the easiest goal to quantify, since it's inherently numerical. The problem is that I've always struggled to find a good dollar amount for my target "nest egg", the amount of money where I'd feel comfortable quitting my job (if I wanted to). The generic target people throw around is a million dollars, because it's a nice round number, and if you're using a 4% safe withdrawal rate (discussion), $40k a year is perfectly livable in many parts of the country that aren't San Francisco.

And sure, we can use $1 million for a rough estimate, but at some point I have to answer some real questions to figure out if that's right or not. Questions like, "do I want kids?" and "how does a significant other fit into my life?" have a huge impact on how much money I should set aside, and how large of a safety margin I need. In the past, I've given a non-answer about keeping my finances flexible and doors open, but that's really just a nicely-phrased cop-out. The older I get, the less useful that answer becomes, which is something I learned the hard way unfortunately. I'm sure I'll address it all in a future post, but for now, we'll use $1 million as our target.

When I moved out to California in May 2015, I had $0. And when I say $0, I mean $0. Like, "strategically skipping meals" broke. It was definitely a rough week or two before I had started work and received my first paycheck.

Thankfully, that's all in the past. At the beginning of 2017, I had ~$125,000 invested. At the beginning of 2018 (i.e. two weeks ago), I had ~$314,000 invested. To clarify, this is the balance of my Vanguard accounts, so it includes my 401k, Roth IRA, and brokerage account. It doesn't include checking accounts, my HSA, any assets (not that I have any), or the change in my cupholder.

As far as financial independence goes, those numbers are heading in the right direction. I saved 50% more in 2017 than in the year and a half before. Granted, those savings are on the back of a very bullish market, which I don't expect to last forever. It'd be unwise of me to try and extrapolate the next few years based on the strong growth of the previous few years. Still, it's not unreasonable to think I could reach our example target in five more years without any crazy cost-cutting on my part.*

A graph of my total invested balance over the past twelve months, courtesy of Vanguard.

My biggest expense this year will likely be travel. I don't really travel for work anymore, since I changed jobs. I'm hoping I can pull together a few personal trips this year, and visit some of the places I've been reading about.

Getting My Beauty Sleep

I'm a big proponent of sleeping, and sleeping well at that. It's been a while since I've talked about tracking my sleep quality, but I've still been recording data for the past few years through the same Android app.

Originally, I wanted to write about how my sleep quality has changed over time. I figured out how to export the data (all ~47,000 data points!), but it's been a massive struggle to parse it into an analyzable format, and then to properly visualize it. Because this post is already almost a month late, I'm going to give up trying to process the data for now.

In short: I have no idea how well I slept in 2017, but I'll do a follow-up post once I figure out how to sift through the data.

Friends and Family

Even if everything in my life was moving along swimmingly, it would be a pretty hollow success if my family and friends weren't doing so hot.

Recently, one of my friends was mistaken for someone else at a bar and legitimately attacked by a very belligerent, very drunk woman. He's fine though, and I'm sure it will be a hilarious story at some point in the future, probably after the gash in his face heals up. Freak bar attacks aside, everyone in my life is doing pretty swell, which makes me happy. Don't really think I need to elaborate on this one.

Looking Forward

I don't want this post to be a self-congratulatory shrine to how awesome I think I am. Reading it over though, that's kind of what it's devolved to. Sure, I'm proud of what I accomplished in 2017, but there's still a lot of room for improvement.

For starters, I got physically weaker, I dropped the ball on some personal relationships, and (in more ways than one) I wasn't as focused as I want to be. I think it's because I've gotten too used to my routine. It makes sense: I've found a good, consistent routine and I like it. The problem is that I get comfortable with it, which takes the edge off the sense of purpose and urgency that usually motivate me. It's hard to sustain that energy when you're doing the same thing over and over.

And that takes a tangible toll. I've noticed I'm less enthusiastic about my workouts, I'll drag my feet and miss sets or even entire days. My passive attention to personal relationships hasn't been enough to keep them healthy, and I've noticed I oscillated idly between projects, making little progress on any of them. Ironically, it looks a lot like the problem I thought the truck would save me from, because I thought the truck was too obnoxious to get comfortable with.

To explain it another way, it feels kind of like that Adam Sandler movie Click. For those who (wisely) stay away from Adam Sandler films, the gist is that a dude gets a magical remote, and one of the things it allows him to do is fast-forward through "uninteresting" parts of his life. While he's able to eventually fast-forward to his goal, he spends most of his life on auto-pilot and everything kind of falls apart as a result.

I said that 2017 was about investing, and it was. I invested in myself and the truck, and it's paid off: I'm closer to my financial goals and not massively stressed out when it rains.

So what's 2018 about then? I'd say finding focus and being present. I've got the routine down and the investments are paying dividends, but I need to get off auto-pilot. I need stay mindful of why I do what I do. I need to be more in the moment. I need to take a more active role in the things I do every day.

But I don't know how to do those things yet. Maybe the solution is to take more deep breaths and dedicate some time each day to just existing. Maybe I'll have to introduce some dynamism into the routine to keep me motivated. I'm not sure. But I know that the work I put in now sets the course for the rest of my life. And if that's not motivation enough, I don't know what is.


Here's to 2018, and to achieving anything you set out to do, whether it takes a day or fifty years.


*One could argue that living in a truck is a "crazy cost-cutting" measure, but at this point it's a pretty foundational part of how I live, and it doesn't feel like a sacrifice. ¯\_(ツ)_/¯


Source: Weirdly enough, I didn't even have to make this image. It was already a part of the the big icon collection I subscribe to.

Obligatory warning: This post is about some of the inner technical workings of the site. If that doesn't tickle your fancy, you might find this unfathomably boring.

Sometimes, when I've exhausted all other interesting or productive things to do, I'll blow the dust off the code that makes this site hum along, and tweak it in one way or another. I've got to say, it's a pretty thankless task. Brandon in 2015 didn't really know what he was doing when it came to building web services in Golang, so the core codebase has historically been…unkempt, to say the least. To say the most, it looked like it was haphazardly slapped together by a team of monkeys banging on typewriters in the wee morning hours at the end of a hackathon.

But with a few more years of professional experience working with these tools, and a couple late nights refactoring the site into submission, making changes and adding functionality isn't nearly as painful these days. So I decided to sit down and fix one of the weaker parts of the site: the search functionality.

I've talked about my original search implementation before. I was (slightly) young(er) and ambitious, and I wanted to do everything myself (except the frontend, because HTML/CSS/JavaScript are the devil). The search code looked something like this:

func buildATerribleSearchIndex() map[string]map[int64]bool {
  // Our "search index" is a big map from words to the post IDs that they
  // appear in.
  invIndex := make(map[string]map[int64]bool)

  for _, post := range getAllOfThePublishedPosts() {
    for _, word := range extractAllTheWordsFromThePostButDoItPoorly(post) {
      // If the word isn't in the index yet, make a submap for it.
      if _, ok := invIndex[word]; !ok {
        invIndex[word] = make(map[int64]bool)
      }
      invIndex[word][post.ID] = true
    }
  }

  return invIndex
}

I removed some of the error-handling for brevity, and made the function names obnoxious because that's who I am, but this is basically what I had. There are a few major problems here:

  1. It's not persisted anywhere. It's stored in-memory. This was pure laziness on my part, and it means we have to rebuild the index every time our server dies. By virtue of the way App Engine manages server instances, it's pretty much guaranteed to kill your server randomly for fun and sport.
  2. We go through allllll the posts. Now I'm not the most prolific writer, but there are over 100 posts, and some of them are fairly long, and App Engine servers are small (by default), and the parsing/delimiting operation isn't exactly cheap. Reindexing all the posts before a page load was actually noticeably slow, on the order of a second.
  3. Index invalidation is hard. Say I want to edit a post (because someone points out I've spelled the word "truk" wrong, for example), how do I update this index? Well, I blow it away and start from scratch obviously! Instead of just removing references to the edited post and reindexing that, I reindex all the things. Again, because laziness.

So, how do we solve any/all of those problems? Well, we put our huge ego aside and leave searching up to people that know what they're doing, let's say, Google, for example. Sure enough, Google has a search API for Go on App Engine, which is exactly what we want. Ripping out my own search code and subbing in calls to Google's API was fairly straightforward, with each post mapping to a unique document.

The result is a faster search system that's easier for me to maintain. The search results are also more accurate, thanks to Google's smarter tokenization rules. And since I'm not indexing anything crazy large, it's also free for me to run. Definitely a big win for the site.

There was just one little problem left to fix: keyword highlighting. When someone searches for something, they're probably interested in finding the text where that keyword occurs. Previously, I had home-rolled a simple (but highly questionable) highlighting system on the backend that would that would find the keyword and wrap it in a <span class="highlight"></span>. This worked except when your keyword also matched something inside an HTML tag (because I write my posts in normal HTML), at which point it would just unceremoniously clobber the HTML and mangle the search results.

I figured, if I'm putting in the effort to make search better, I might as well make the whole experience actually work. So I sprinkled some mark.js magic on the search page in the frontend, and all was well with the world end-to-end search experience. Well, except for the fact that the search box got moved into obscurity at the bottom of the page after my last site redesign, but I'll probably fix that in a future update. Until then, feel free to scroll allllll the way to the bottom of the page and give the search functionality a try. As always, email me or drop a comment if you have any problems.

Next Up

Like I alluded to in my last post, I spent a lot of time the past few months not writing blog posts building different websites as Christmas presents for my friends and family. This was mostly an excuse to learn how to use modern frontend technologies for building responsive single-page applications, including actual frontend tests and minified/productionized assets. I'm currently in the process of rewriting the blog as two separate pieces: an API server that speaks a basic CRUD protocol to serve posts, questions, etc, and a static frontend that makes calls to this API server. If all goes well, nobody will even notice when I roll it out.



Subscribe

If you want to get emailed when I write a post, add your email here. Don't worry, you can always unsubscribe.