-
Notifications
You must be signed in to change notification settings - Fork 550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search doesn't work with "a" or "i" #233
Comments
The problem you are having is that both 'a' and 'i' are stop words and so are filtered out by The stop word filter is run as part of indexing and querying, this is because those words are very common and add little to differentiate between documents, almost every English document will contain these words. If you really want to search for 'a' or 'i' (or any other word that by default lunr considers a stop word) you have two options:
Removing the stop word filter is simple, but will likely have a negative impact on the relevance scores of searches and will definitely increase the size of the index. var idx = lunr(function () {
// normal index definition
this.pipeline.remove(lunr.stopWordFilter)
}) Alternativley you can create your own stop word filter, the default stop word filter is built using var idx = lunr(function () {
// normal index definition
this.pipeline.after(lunr.stopWordFilter, myStopWordFilter)
this.pipeline.remove(lunr.stopWordFilter)
}) |
Thanks Oliver, that makes total sense. I'll close this as a non-issue. |
As the title suggests, Lunr doesn't work with a search query of "a" or "i". Returns empty array.
Demo here:
https://jsfiddle.net/6qtmh2g7/
The text was updated successfully, but these errors were encountered: