I want to add a trimmer (called improvedTrimmer) before the multilanguage one added by lunr-language. What I'm not able to find is how to pass the existing function to this.pipeline.before()
or this.pipeline.after()
. Here are my attempts that always throw "Error: Cannot find 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);
Around on the web there are few suggestions that do not work with the current version of lunr.