Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taojunnan/vuepress-plugin-full-text-search
vuepress full text search 中文全文搜索插件
https://github.com/taojunnan/vuepress-plugin-full-text-search
chinese chinese-full-text-search full-text-search vuepress vuepress-plugin
Last synced: 6 days ago
JSON representation
vuepress full text search 中文全文搜索插件
- Host: GitHub
- URL: https://github.com/taojunnan/vuepress-plugin-full-text-search
- Owner: taojunnan
- Created: 2020-04-09T06:44:22.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-04-09T07:28:59.000Z (over 4 years ago)
- Last Synced: 2024-11-08T03:41:32.720Z (about 2 months ago)
- Topics: chinese, chinese-full-text-search, full-text-search, vuepress, vuepress-plugin
- Language: Vue
- Homepage:
- Size: 6.84 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vuepress 中文全文搜索插件
> 代码来自[https://github.com/leo-buneev/vuepress-plugin-fulltext-search](https://github.com/leo-buneev/vuepress-plugin-fulltext-search),但是只支持英文全文搜索,做了部分改动
## 改动说明
+ 修改[flexsearch](https://github.com/nextapps-de/flexsearch)默认配置+ 使用中文分词模块[segmentit](https://github.com/linonetwo/segmentit)
```js
// ./services/flexsearchSvc.js
// flexsearch 默认配置的修改, 以及引入中文分词模块
let defaultOptions = {
encode: false,
async: true,
tokenize: function(str){
var result = segmentit.doSegment(str, {
simple: true
});
return result;
}
}
```
## 如何使用
+ 把整体代码拷贝到vuepress项目目录下,如
```
.
├─ docs
├─ myPlugins
│ └─ fullSearchBox // 当前插件所在文件夹
└─ package.json
```
+ 在`config.js`中引用该插件
```js
plugins: [
require.resolve('../../myPlugins/fullSearchBox/')
]
```+ 在`package.json`中加入以下依赖
```json
"devDependencies": {
"flexsearch": "nextapps-de/flexsearch",
"html-to-text": "^5.1.1",
"segmentit": "^2.0.3",
}
```
+ 安装依赖```
npm i
```+ 运行
## 不足的地方
加载segment词典会有1 - 2s的卡顿
## License
MIT