- I <3 Jekyll. So do you. - Most Jekyll sites don’t include search - Search is complicated - There are other solutions, but no me gusta - My blog needs search But I really, really, really want to use powerful search, and I don’t want to have to break up with Jekyll for it.
site with awesome search It needs to support: - Full-text search. - Fast queries. - Type-ahead find. - Highlighted results. - The option to filter based on document data (dates, categories, tags). - Hosting on Github pages. - Completely open-source & customizeable.
to get stuff into Elasticsearch using searchyll 4. How searchyll works 5. How to get stuff out of Elasticsearch (ie, searching it) What we’re going to talk about
- Based on Apache Lucene, like Solr. - Distributed, enterprise-grade, scalable. - It does cool stuff, like highlighting, filtering, and a million cool things. The API is extensive and very developer friendly. - It is its own Webserver - It speaks HTTP! 1. Why Elasticsearch?
URL to the same cluster 3. A Jekyll site with posts. 4. A client-side javascript framework to search things. Q: What do I need to get it to all work? A: 4 things.
your config.yml, with some options 3. Wrap the content you want to be able to search in an <article/> tag 4. Run the indexing process a. Locally: $ BONSAI_URL=url jekyll build b. In production: $ BONSAI_URL=url bin/deploy Q: How do I get my posts to Elasticsearch? A: POST your posts to an index
hooking to the : post_render phase 2. Run it through Nokogiri to pick up text in the article tag 3. Send it off to an Indexer, which communicates with Elasticsearch via ruby netHttp Q: How does Searchyll work? A: Jekyll Hooks + Indexer.
- Hot reindexes using the _alias endpoint. - Indexes in batches using with _bulk endpoint. - Removes any old indices under the same alias if you’re reindexing.
I also have to use React b. I’m using webpack to build, compile, and test my scripts. 2. I have a handy blog post on how to do this in more detail that I’ll link at the end. Q: How do I get stuff out of Elasticsearch? A: Public read-only cluster URL + Javascript.
vars. 2. Run your indexing locally just before publishing to github: 3. Remove searchyll from the gemfile and config 4. Publish to Github Pages Q: How can I use this if I’m on Github Pages? A: index locally + remove searchyll. $ BONSAI_URL="https://user_name:[email protected]" jekyll build
it for me! - Fork, customize, collaborate, submit issues: - https://github.com/omc/searchyll - Set up Search with your Jekyll site: - http://allizad.com/code/2016/05/02/using-webpack-with-jekyll/ - http://allizad.com/code/2016/05/06/elasticserch-for-jekyll/ - Share your cool use cases!: - @bonsaisearch - Get a Free developer Sandbox cluster with the public read-only feature: - [email protected] subject_line: JekyllConf & Bonsai Thanks!