有两个md,一个是英文内容,一个是中文内容
md中有中文也能搜索
英文的能被搜索到,中文的不能被搜索到
config.js
module.exports = {
title: '标题',
description: '测试项目',
base: '/vuepress/',
configureWebpack: {
resolve: {
alias: {
'@alias': './assets/'
}
}
},
dest: './dist',
themeConfig: {
nav: [
{ text: 'Home', link: '/' },
{ text: 'Blog', link: '/blog/' },
{ text: 'About', link: '/about/' },
],
sidebar: [
{
title: 'Blog',
collapsable: false,
children: [
'/blog/',
'/blog/first'
]
}
],
sidebarDepth: 3
}
}
May be duplicated of #2242
https://vuepress.vuejs.org/zh/theme/default-theme-config.html?#algolia-%E6%90%9C%E7%B4%A2
是不是只能用 algolia搜索了?
https://vuepress.vuejs.org/zh/theme/default-theme-config.html?#algolia-%E6%90%9C%E7%B4%A2
是不是只能用 algolia搜索了?
@jimwmg 你可以去看下0.x版本的searchBox的代码,移植过来,以前版本是可以的
https://vuepress.vuejs.org/zh/theme/default-theme-config.html?#algolia-%E6%90%9C%E7%B4%A2
是不是只能用 algolia搜索了?@jimwmg 你可以去看下0.x版本的
searchBox的代码,移植过来,以前版本是可以的
试过几个0.x版本呢,都不行
@taojunnan 我也是一样的问题。卡了两天了以为我自己的问题。但是我github上下载其他人的代码,在我电脑上运行,是没有问题的。
https://vuepress.vuejs.org/zh/theme/default-theme-config.html?#algolia-%E6%90%9C%E7%B4%A2
是不是只能用 algolia搜索了?@jimwmg 你可以去看下0.x版本的
searchBox的代码,移植过来,以前版本是可以的试过几个0.x版本呢,都不行
@Teacher-Li 这是我GitHub上随便找的例子运行是可以的,版本0.7.1,链接
@taojunnan 我也是一样的问题。卡了两天了以为我自己的问题。但是我github上下载其他人的代码,在我电脑上运行,是没有问题的。
@liqingchang0365 vuepress版本问题,我对比了下1.x和0.x的searchBox代码,1.x版本用的\b正则匹配单词边界,但不适用于中文,0.x版本直接用的indexOf().
0.x
item.title && item.title.toLowerCase().indexOf(query) > -1
1.x
`(?=.*\\b${escapeRegExp(word)})`
我也发现了,最近 #1557 的被合并了,导致不能搜索到中文了,希望官方能修复下吧
@ulivz
这是不能搜索到中文的仓库:https://github.com/zq99299/linux-tutorial
这是可以搜索中文的仓库:https://github.com/zq99299/note-book
@taojunnan 我也是一样的问题。卡了两天了以为我自己的问题。但是我github上下载其他人的代码,在我电脑上运行,是没有问题的。
@liqingchang0365
vuepress版本问题,我对比了下1.x和0.x的searchBox代码,1.x版本用的\b正则匹配单词边界,但不适用于中文,0.x版本直接用的indexOf().
0.xitem.title && item.title.toLowerCase().indexOf(query) > -1
1.x`(?=.*\\b${escapeRegExp(word)})`
感谢!
yarn add @vuepress/[email protected]
重启项目,问题解决
我目前还是通过:https://community.algolia.com/docsearch/ 解决的,本地启动的还是无法支持 全局 + 中文搜索
我目前还是通过:https://community.algolia.com/docsearch/ 解决的,本地启动的还是无法支持 全局 + 中文搜索
@jimwmg 申请不下来,有些主要还是公司内部查阅的文档,没有挂外网
紧急的话可以考虑先用 1.3 版本。
Closing this as duplicated of #2242
Most helpful comment
https://github.com/vuejs/vuepress/pull/2266/commits/b59288310a642497d4e954189922cc7393a3e1f0
有老哥提了Pr呢