Hugo Search Index with some stop words filtered

I re-wrote my search index for Algolia, removing “some” stop words to reduce the byte size of my documents (this was about a 6% savings, not much, but they have size limits, so I think it’s worthwhile).

If anyone has feedback/improvements, it’s welcome. I tried to list my stop words in a variable, but was having trouble with that.

There’s also a post where @JeffProd created a search index (and search). I didn’t use it because my site is big, but it looks interesting, nonetheless. https://en.jeffprod.com/blog/2018/build-your-own-hugo-website-search-engine/

6 Likes

This is really awesome, @budparr. Thanks much for sharing. Out of curiosity, have you noticed whether the semi-long stopword list has increased your build times at all?

That was a criteria for me. It does not seem to, no. I may try a longer list at some point, but this is encouraging (and made me a bit better at Go/Hugo flavored regex).

1 Like