Closed cbdeveloper closed 5 years ago
It looks like you are running into the stop word filter, this is designed to remove very common words from the index, usually they are not very useful when performing a search because they exist in almost every document. The two texts in your example are almost entirely stop words, only "best" and "post" are not, this is why you are seeing the behaviour you are.
You can remove the stop word filter, but be aware it will increase the size of the index:
var idx = lunr(function () {
this.pipeline.remove(lunr.stopWordFilter)
})
There are a bunch of options when it comes to search, both wildcards and fuzzy matches.
I'm having some difficulties while trying to implement a basic search index with lunr. It's kind of working but I'm not been able to match some words and you can see from the GIF below:
I've got only 2 "posts" added to the index.
Building the lunr index
Doing Searches
I made this example available on CodeSandbox https://codesandbox.io/s/y10nwyx91
Question1: What is going on with my example ? Am I doing something wrong or is this a bug? I tried to follow the documentation as best as I could.
Question2: Can I make lunr match part of words (tokens) ?