From cd11ed1c3a8d6939eb03486bf232ace72e7b5bdf Mon Sep 17 00:00:00 2001 From: lianzhao Date: Sun, 21 Nov 2021 17:48:43 +0800 Subject: [PATCH] load nodejieba dict on init --- lunr.zh.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lunr.zh.js b/lunr.zh.js index 14a177c..c3ac373 100644 --- a/lunr.zh.js +++ b/lunr.zh.js @@ -64,6 +64,8 @@ /* register specific locale function */ lunr.zh = function() { + nodejiebaDictJson && nodejieba.load(nodejiebaDictJson) + this.pipeline.reset(); this.pipeline.add( lunr.zh.trimmer, @@ -90,8 +92,6 @@ return isLunr2 ? new lunr.Token(t.toLowerCase()) : t.toLowerCase() }) - nodejiebaDictJson && nodejieba.load(nodejiebaDictJson) - var str = obj.toString().trim().toLowerCase(); var tokens = [];