【发布时间】:2019-06-17 17:02:05
【问题描述】:
如何让docfx 用俄语搜索? 它可以很好地搜索英语单词,但不能搜索俄语单词。我尝试调试它,可以看到它使用 lunr 库进行搜索。如何在docfx中用俄语lunr替换标准lunr库?
【问题讨论】:
如何让docfx 用俄语搜索? 它可以很好地搜索英语单词,但不能搜索俄语单词。我尝试调试它,可以看到它使用 lunr 库进行搜索。如何在docfx中用俄语lunr替换标准lunr库?
【问题讨论】:
结果很简单: 为了支持除支持 lunr 的语言之外的其他语言,请使用此 repo: https://github.com/MihaiValentin/lunr-languages
从docfx 中打开search-worker.js 文件并按照github 建议的自述文件进行一些修改:
添加导入
importScripts('lunr.stemmer.support.js');
importScripts('lunr.ru.js');
将这些文件从 github 复制到带有 lunr.js 的文件夹中
修改如下方法:
var lunrIndex = lunr(function() {
this.pipeline.remove(lunr.stopWordFilter);
Add this line...>this.use(lunr.ru);
this.ref('href');
享受吧。
【讨论】: