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
معهد ماساتشوستس للتكنولوجيا