moroshko / autosuggest-trie

Minimalistic trie implementation for autosuggest and autocomplete components
MIT License
25 stars 4 forks source link

Doesn't do partial search #1

Closed SunilAgrawal closed 8 years ago

SunilAgrawal commented 8 years ago

If the key is 'San Francisco' and search for 'cisc' then doesn't show 'San Francisco'. Is it a easy fix?

moroshko commented 8 years ago

The data structure that is used in this library (trie) was designed to find partial matches only at the beginning of a word (it allows super fast queries). For example, it will find San Francisco if the query is sa or fran, but not an or cisc. This is usually what autosuggest components need. If you need to find partial matches in the middle of a word, you'll have to find another library that does that.