lunr:如何添加一个新的修剪器

时间:2018-05-24 19:01:08

标签: node.js lunrjs

我希望在由lunr语言添加的多语言之前添加一个修剪器(称为ImprovedTrimmer)。我无法找到的是如何将现有功能传递给this.pipeline.before()this.pipeline.after()。以下是我总是抛出的尝试"错误:无法找到existingFn":

fullTextIndex = lunr(function() {

    this.use(lunr.multiLanguage("en", "it"));

    // This works, but put my trimmer at the end of the pipeline
    // this.pipeline.add(improvedTrimmer);

    // This says lunr.trimmer not found. Idem with this.trimmer
    // this.pipeline.after(lunr.trimmer, improvedTrimmer);

    // This seems the most logical choice, but no way (the string is
    // the synthesized trimmer label by the multilanguage plugin
    // this.pipeline.before("lunr-multi-trimmer-en-it", improvedTrimmer);

    // This works, but seems very a dirty workaround
    this.pipeline.after(this.pipeline._stack[0], improvedTrimmer);

在网络上,有一些建议无法与当前版本的lunr一起使用。

0 个答案:

没有答案