manastech / middleman-search

LunrJS-based search for Middleman
MIT License
58 stars 31 forks source link

only try to use lunr_lang if @language is not "en" #19

Closed jronallo closed 7 years ago

jronallo commented 7 years ago

If no search.language is set then building the site fails. Setting the language to "es" and the index builds.

This pull request only tries to use lunr_lang if @language is not "en" since lunr_lang only gets defined if the language is not "en".

This is the error that I get:

at t.Index.use (/home/jnronall/.rvm/gems/ruby-2.3.1/bundler/gems/middleman-search-3be9d42770f1/vendor/assets/javascripts/lunr.min.js:7:10009): Cannot call method 'apply' of null (V8::Error)
    from /home/jnronall/.rvm/gems/ruby-2.3.1/bundler/gems/middleman-search-3be9d42770f1/lib/middleman-search/search-index-resource.rb:66:in `block in build_index'
    from at t (/home/jnronall/.rvm/gems/ruby-2.3.1/bundler/gems/middleman-search-3be9d42770f1/vendor/assets/javascripts/lunr.min.js:7:114)
    from /home/jnronall/.rvm/gems/ruby-2.3.1/bundler/gems/middleman-search-3be9d42770f1/lib/middleman-search/search-index-resource.rb:74:in `build_index'
    from /home/jnronall/.rvm/gems/ruby-2.3.1/bundler/gems/middleman-search-3be9d42770f1/lib/middleman-search/search-index-resource.rb:29:in `render'
spalladino commented 7 years ago

Ouch. I guess we broke this in c6b7e953c1ffc14f5340b828e9ad2a560bd0c705. Thanks a lot for the PR!