dillonzq / LoveIt

❤️A clean, elegant but advanced blog theme for Hugo 一个简洁、优雅且高效的 Hugo 主题
https://hugoloveit.com
MIT License
3.37k stars 1.07k forks source link

[BUG] Lunr search doesn't work in non-default language #403

Open nekr0z opened 4 years ago

nekr0z commented 4 years ago

With Lunr search enabled, search works as expected in default language.

If switched to another language on a multilingual site, search does not work. Attempts to enter search term in the search feed result in

TypeError: Cannot read property 'apply' of undefined
    at e.Builder.use (lunr.min.js:6)
    at e.Builder.<anonymous> (theme.js:219)
    at e (lunr.min.js:6)
    at theme.js:218

in the browser console.

py563 commented 4 years ago

is this on your website? then above mentioned error message is displayed only in English version search not on default language which I guess is Russian on your site, I tried random English words that are not in blog posts. But I can also see it doesn't return any results for even copied text from first article on search bar even in default version. I cannot reproduce these errors on a website that I am testing this theme on.

nekr0z commented 4 years ago

Yes, that's on my website (it runs a heavily customized LoveIt, but I get same results with current master of LoveIt).

Lunr is strange, it only searches for the last word in the input, but for me in Russian it does so reliably. It doesn't find any non-cyrillic words in Russian version of my site (although there are such words), though, but it gives no error in this case.

In the English version it always gives error.