Skip to content

Instantly share code, notes, and snippets.

View jcoffland's full-sized avatar

Joseph Coffland jcoffland

View GitHub Profile
@r3wt
r3wt / GhostSearch.js
Created February 25, 2019 18:10
Search + Archive Implementation for a Ghost Blog
// begin config
const ghost_host = '<your host here>';//your blogs domain -- see documentation of tryghost/content-api
const ghost_key = '<your key here>';//key to your integration -- see documentation of tryghost/content-api
const updateInterval = 60000;//how often the index should update given in milliseconds
const requestTimeout = 5000;// maximum time for a search request before it times out given in milliseconds (note this isn't exact, it depends on the load of the event loop)
const resultsPerPage = [8];// allowed values for limit. in my case we only allow 8, but made this configurable so users of ghost can benefit
// end config
const elasticlunr = require('elasticlunr');