itemsapi / itemsjs

Extremely fast faceted search engine in JavaScript - lightweight, flexible, and simple to use
Apache License 2.0
346 stars 41 forks source link

Add option to remove stemmer and/or stopWordFilter of lunr. #43

Closed Letrab closed 5 years ago

Letrab commented 5 years ago

I had issues with certain search queries where my expected results were not showing up. See attached testcase for this.

Apparently the stemmer could lead to unexpected results. Same goes for stopWords, filtered by the stopWordFilter, are filtered out when it would partially match your word you are searching for.

Added the options to be able to remove the stemmer and stopWordFilter for this. I chose for the addition of this configuration option to not break any existing functionality.

cigolpl commented 5 years ago

Looks good! How about calling it i.e. isPartialSearch as true which set removeStemmer as false and removeStopWordFilter as false ? Would it be enough to cover that case in 100% ? I'd prefer personally if ItemsJS users / developers don't need to deal with lunr / search engine names complexity (tokenizer, stemmer, etc)

Letrab commented 5 years ago

Good point! How about calling it isExactSearch which defaults to false (so it won't change existing code)? Setting it to true removes both the stemming and the stopword filter?

(For me the name isPartialSearch is a bit confusing of what is does exactly :-))

cigolpl commented 5 years ago

Cool, that makes sense to me

Letrab commented 5 years ago

Done!

cigolpl commented 5 years ago

Great, merged and released new version on npm

Letrab commented 5 years ago

Thanks!