hexo-theme-butterfly icon indicating copy to clipboard operation
hexo-theme-butterfly copied to clipboard

[Bug]: 配置了algolia search,搜索没有返回值,报错algolia.js:96 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'value')

Open khalitt opened this issue 3 years ago • 7 comments

使用的 Butterfly 版本? | What version of Butterfly are you use?

4.4.2

使用的瀏覽器? || What browse are you using?

Chrome

使用的系統? || What operating system are you using?

macOS

問題描述 | Describe the bug

配置了algolia search,搜索没有返回值,报错algolia.js:96 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'value') image

但实际是有搜索结果的 image

出現問題網站 | Website

https://khalitt.github.io/

khalitt avatar Jun 20 '22 15:06 khalitt

https://github.com/jerryc127/hexo-theme-butterfly/issues/923

jerryc127 avatar Jun 20 '22 18:06 jerryc127

#923

报错的行不一样,923是98行,这里是96行

khalitt avatar Jun 21 '22 02:06 khalitt

你用的是哪个插件

jerryc127 avatar Jun 21 '22 05:06 jerryc127

algoliasearch

khalitt avatar Jun 21 '22 06:06 khalitt

如 #923 所述,如果你使用的是这个插件,那么在使用稳定版的前提下,你需要配置好必须的参数,由你截图可知 path或者 permalink 似乎并未配置, content 也未配置,所以没有返回内容是报错正常的,当然报错确实是因为当时在处理这部分的时候没有考虑全面

另外,即使是最新 dev 版本,因为太久没用过 hexo-algolia 插件,也没看源码,不确定是否已经可以生成或自定义 content,所以仍然建议如果非必要全站搜索,只是搜索文章还是使用 hexo-algoliasearch 插件

另外tags参数如果你未修改js的话,不会返回具体匹配内容,对搜索结果呈现没有帮助,当然你也可以配置一下可搜索数据,使之可搜索,建议是删除此参数,以缩短响应时间

CCKNBC avatar Jun 21 '22 14:06 CCKNBC

感谢回答,现在我用的就是hexo-algoliasearch这个插件,也尝试过把permalink等参数全部加进来,可搜索数据也把所有参数配上了,但是问题依旧 image

image image image image

khalitt avatar Jun 21 '22 16:06 khalitt

使用最新版看看还有没有问题

jerryc127 avatar Jun 25 '22 11:06 jerryc127

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 12 '22 01:08 stale[bot]