You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Discovered in lunr.py: yeraydiazdiaz/lunr.py#151 - but the same issue (and a similar workaround) exists in lunr.js. As noted in the example it is actually a pretty serious problem:
constlunr=require("lunr");constindex=lunr(function(){this.field("title");this.field("body");this.add({title: "To be or not to be?",body: "That is the question!",});});// Should print something, but doesn't!console.log(index.search("What is the question?"));
The text was updated successfully, but these errors were encountered:
And just to help anyone who runs into this problem (unless a new release of lunr.js happens which appears unlikely) the workaround is simple (though not as clear as it is in Python...):
constlunr=require("lunr");constindex=lunr(function(){this.use(function(builder){builder.searchPipeline.before(lunr.stemmer,lunr.trimmer);});this.field("title");this.field("body");this.add({title: "To be or not to be?",body: "That is the question!",});});console.log(index.search("What is the question?"));
Edited the above because adding the stopword filter to the search pipeline actually isn't useful (probably why the code is the way it is?) - if the terms aren't in the index they just won't get found, obviously.
Discovered in lunr.py: yeraydiazdiaz/lunr.py#151 - but the same issue (and a similar workaround) exists in lunr.js. As noted in the example it is actually a pretty serious problem:
The text was updated successfully, but these errors were encountered: