lucaong / minisearch

Tiny and powerful JavaScript full-text search engine for browser and Node
https://lucaong.github.io/minisearch/
MIT License
4.9k stars 137 forks source link

Partial matching inside words? #67

Closed Uninen closed 4 years ago

Uninen commented 4 years ago

First, Thank You for minisearch, it's a great tool! 👍

My question: is there a way to include results that would find an item containing the word Raymond with search mon (Ie. the same kind of results that String.prototype.includes() yields)?

lucaong commented 4 years ago

Hi @Uninen , thanks for the kind words! As to your question, no, unfortunately, MiniSearch won't match inside words (apart from cases that can be solved with fuzzy matching, like "aymon" for "Raymond"). If the match was at the beginning of the word, you could use prefix search, but otherwise I am afraid MiniSearch is not the right tool for this case.

Uninen commented 4 years ago

Ok, thanks for your reply 👍

lucaong commented 4 years ago

Welcome 🙂 it might help to add that lunr.js, while lacking other features that MiniSearch has, and being in my opinion more complex, might be a better fit for this specific case, as you can specify searches like "*mon*". Take into consideration, though, that those kind of searches will not be performant on big indexes.