jekyll-lunr-js-search
jekyll-lunr-js-search copied to clipboard
Disable search indexing via cmd line flag
When developing new content, waiting for the site to index after a file save is the largest delay.
It would be preferable to pass a flag to jekyll when running locally to temporarily disable the indexing. One great option would be:
jekyll serve --no-index
however this may not be possible. Alternativelly, create a _disable_search.yml
config file containing:
jekyll-lunr-js-search: disable
and start jekyll with:
jekyll serve --config _config.yml _disable_search.yml
This, however, requires that jekyll-lunr-js-search detects and honours the jekyll-lunr-js-search: disable
yml variable.
It's possible to disable custom plugins by running Jekyll with the --safe
flag (documentation).
Is that good enough for what wish to do?
I did try that but I use other plugins (pandoc in particular) which are required during development.
Sent from my Phone
On 11 Jul 2014, at 13:12, Ben Smith [email protected] wrote:
It's possible to disable custom plugins by running Jekyll with the --safe flag (documentation http://jekyllrb.com/docs/configuration/).
Is that good enough for what wish to do?
— Reply to this email directly or view it on GitHub https://github.com/slashdotdash/jekyll-lunr-js-search/issues/32#issuecomment-48723113 .
I have recently started to embed ipython notebooks into the site. These take a very long time to index, so an ability to disable this for development is even more pressing. Even an ability to exclude files or to only reindex changed files would work, although this seems a little off-topic for this issue.
I am happy to look at implementing this and provide a pull request, but I could use some steering as I am new to ruby.
A quick workaround that might help you:
Rename the jekyll_lunr_js_search.rb
file in the _plugins
directory (e.g. to .rbx
) and it will then be ignored by Jekyll. Remember to restore the .rb
extensions before generating the actual site.
That sounds like exactly what I need! Thanks, I will try that in the morning.
Sent from my Phone
On 4 Aug 2014, at 15:28, Ben Smith [email protected] wrote:
A quick workaround that might help you:
Rename the jekyll_lunr_js_search.rb file in the _plugins directory (e.g. to .rbx) and it will then be ignored by Jekyll. Remember to restore the .rb extensions before generating the actual site.
— Reply to this email directly or view it on GitHub https://github.com/slashdotdash/jekyll-lunr-js-search/issues/32#issuecomment-51067006 .
This does works as intended. A flag remains preferable as it doesn't result in the script appearing as renamed in my git status, but it is fine as a workaround.
Hey @calvingiles, I was in the code and it wasn't going to take long so I implemented this with PR #47. It's built on top of #46 (which will require a couple of changes to your JS code) but you can add these lines to your plugin if you want to have this feature now. You'll then need to use this command:
jekyll build -- --no-lunr-index
What do the extra --
do?
Is this going to be in a release any time soon? Otherwise I will look at integrating your changes.
The --
tells jekyll that any arguments following should be passed to ruby, rather than assumed to be a command to jekyll
(this happens with a large number of ruby and non-ruby cli apps) - you can see what I mean if you try with and without the double dash.
I imagine it'll be merged into the master branch if and when the owner (slashdotdash) approves of the changes I've made. By all means copy those lines into the plugin if you've manually added it to your _plugins
folder if you need the functionality before then.
Thank you @jphastings. I'm running into the same delays while developing my projects, due to this plugin updating the index every time. It would be great if @slashdotdash approves and merges your pull request.