Add Lunr Search Plugin For Blog

Published: 31 Jul 2016 Category: web_dev

I decided to add a full-text search plugin to my blog: .

Although it should be an easy work, there are still some rules I think are somewhat crucial to follow (for me..).

First rule: DO NOT try to do this on Windows.

On windows (and OS X), you can not even manage to gem install therubyracer, which is essential component required by jekyll-lunr-js-search. See my previous post:

Keep yourself aware that you don’t include jQuery twice. It can really cause all sorts of issues.

This post explains in a more detail:

Double referencing jQuery deletes all assigned plugins.

It kept me receiving one wired error like:

TypeError: $(...).lunrSearch is not a function

and took me a long time to find out why this happened.

For a newbie like me who know nothing at all about front-end web development, all the work become trial and error, and google plus stackoverflow. So great now it can work.

Thanks to My Chemical Romance for helping me through those tough debugging nights!