AlynxZhou / stackharbor

喵's StackHarbor
https://sh.alynx.one/
3 stars 2 forks source link

前端博客搜索引擎 #39

Open LGiki opened 4 years ago

LGiki commented 4 years ago

本来我的博客有一个前端搜索框,当输入文字时就在侧边栏展开搜索结果,虽然看起来很时髦,但也不能算是什么食用啊不实用的设计方式。

⚠️ 发现错别字:"食用" => "实用"

AlynxZhou commented 4 years ago

本来我的博客有一个前端搜索框,当输入文字时就在侧边栏展开搜索结果,虽然看起来很时髦,但也不能算是什么食用啊不实用的设计方式。

warning 发现错别字:"食用" => "实用"

故意的没看出来嘛(

SukkaW commented 4 years ago

这个思路算起来的话,最早应该是我想出来的(虽然那时候是我初学 JS 时写的,特别 dirty(x https://github.com/SukkaW/hexo-theme-suka/blob/master/src/js/local-search.js

AlynxZhou commented 4 years ago

这个思路算起来的话,最早应该是我想出来的(虽然那时候是我初学 JS 时写的,特别 dirty(x https://github.com/SukkaW/hexo-theme-suka/blob/master/src/js/local-search.js

虽然思路和实现代码都很像,而且确实是你先提交的代码,但我写的时候完全没参照过别人代码,也不知道你实现过这个功能。

以及你这个在搜索多个空格分割的关键词时候有 bug,我刚才用你博客试了一下……

Fetch API 的使用学习了,有时间改一下。

lilydjwg commented 4 years ago

@SukkaW 2018年就想拿第一,你也太天真了点。

SukkaW commented 4 years ago

@AlynxZhou https://github.com/SukkaW/hexo-theme-suka/blob/canary/src/js/local-search.js 空格的问题其实我修了,思路就是直接把空格当成分词、把 + 做分隔符,但是没合并进 master 里。。。

AlynxZhou commented 4 years ago

@AlynxZhou https://github.com/SukkaW/hexo-theme-suka/blob/canary/src/js/local-search.js 空格的问题其实我修了,思路就是直接把空格当成分词、把 + 做分隔符,但是没合并进 master 里。。。

我当时还想了个问题是如果这样 https://github.com/SukkaW/hexo-theme-suka/blob/canary/src/js/local-search.js#L116 循环替换关键词,万一中间有个关键词叫 mark 或者 strong 是不是就炸了?