vuepress plugin full text search
1.0.0
이 코드는 https://github.com/leo-buneev/vuepress-plugin-fulltext-search에서 제공되지만 영어의 전체 텍스트 검색 만 지원하며 일부 변경 사항이 이루어졌습니다.
기본 FlexSearch 구성을 수정하십시오
중국어 단어 세분화 모듈 세그먼트를 사용하십시오
// ./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 에서 플러그인을 참조하십시오
plugins: [
require . resolve ( '../../myPlugins/fullSearchBox/' )
] package.json 에 다음 종속성을 추가하십시오
"devDependencies" : {
"flexsearch" : " nextapps-de/flexsearch " ,
"html-to-text" : " ^5.1.1 " ,
"segmentit" : " ^2.0.3 " ,
}설치 종속성
npm i
달리다
로딩 세그먼트 사전은 1-2S 지연을 유발합니다
MIT