21

I am looking into migrating my site from Wordpress to Jekyll and would like to maintain the ability to have full-text search for the site. The Wordpress search was fast, reliable, and nicely formatted to match the theme, and I haven't found a decent replacement.

There's a plugin solution that uses indextank, but I am not interested in tying my search through a commercial API with users ranking the search items, I just want something comparable to Wordpress search.

I've also looked into the google Ajax api, but I don't want a floating ajax search box on the site.

There's always google's search for the website, but I haven't found this to be as reliable. (I haven't tried this since I moved to wordpress a few years ago, so perhaps I'm mistaken).

Since all posts are available in plain-text, it seems like it should not be to difficult to create an index for searching them when the site is built, but I have not found a good solution. Any suggestions or examples?

cboettig
  • 12,377
  • 13
  • 70
  • 113
  • Are you running this on your own webserver? (i.e. can you run server-side scripts?) – huon Apr 13 '12 at 13:58
  • I am, though I'd be interested to know if there were solutions that worked for github hosted sites as well. – cboettig Apr 13 '12 at 18:53
  • 2
    I am afraid on GitHub your best option is a JavaScript search, like [Tipue Search](http://tipue.com/search/). – manatwork Apr 14 '12 at 13:43
  • @mantawork -- Nice suggestion. It's not clear to me how Tipue Search generates the data in tipuesearch_data.js -- does this have to be entered manually? – cboettig Apr 17 '12 at 01:57
  • Answering @manatwork: no, the data does not need to be entered manually. Alex Pearce has a [great blog post here](http://alexpearce.me/2012/04/simple-jekyll-searching/) that includes an example of how your site data can be dynamically created (I suggest replacing 'null' with 'false'). The example creates a .json file that's used to create a tag page, but the code can also create a .js file that helps to return user-entered search results on Tipue. – kaidez May 23 '13 at 12:50

4 Answers4

20

Jekyll + lunr.js = powerful full-text search, using JavaScript in your browser, for your Jekyll static website

Ben Smith
  • 2,369
  • 20
  • 17
  • Thanks! Does this load all the site text into browser memory then? Seems like that solution might not scale well, though obviously it takes a lot of text to take up much space. I'm currently using a tweaked version of Marran's stemming search: http://www.marran.com/tech/jquery-full-text-indexing-on-jekyll/ – cboettig Mar 06 '13 at 15:54
  • @cboettig yes, it will load the entire index into memory for searching. Would depend upon the size of your Jekyll site, something to consider for large sites. Not sure exactly how 'large' it would need to be to cause an issue. – Ben Smith Mar 07 '13 at 09:35
  • Iron.io is moving to Lunr.js are there good examples of sites that execute the user experience well? – Stephen Nguyen Sep 29 '14 at 18:22
  • @BenSmith Can it work on the server? I following you step. It works when I use jekyll server. But I upload that to the server. It doesn't work – Samuel Feb 15 '15 at 05:08
  • Lunr.js is a static full text search engine writter in javascript, it doesn't need any backend or server. – Miloš Miljković Oct 09 '16 at 21:01
5

One option to investigate Google Custom Search.

You mention trying to use Google in the past, but I'm not sure if you mean the custom search box as described here. Posting this in case it helps.

Alan W. Smith
  • 24,647
  • 4
  • 70
  • 96
  • I understand google custom search is just a wrapper around site search that lets you embed the results (with advertisements in the free version) into the body of your website? It does look like they let you customize the css a bit to match. This is helpful but not quite what I'm looking for. – cboettig Apr 18 '12 at 17:26
  • I'm working on getting my jekyll site up and running too. If I figure out something else, I'll post back here. – Alan W. Smith Apr 18 '12 at 22:09
  • After trying both Ben's lunr.js solution (above) and Marran's less memory-intensive [fast stemming search](http://www.marran.com/tech/jquery-full-text-indexing-on-jekyll/) I've settled on rolling back to this simple Google search. When I need something different I just grep against my repo copy ;-) – cboettig Jan 03 '14 at 06:44
3

https://github.com/flaptor/indextank-jquery

hackhowtofaq
  • 458
  • 5
  • 8
3

https://github.com/chinchang/super-search/

This requires no extra configuration. Just plug and play library that works on your jekyll blog's RSS feeds with neat on-page search UI.

Kushagra Gour
  • 4,568
  • 2
  • 22
  • 26