corejavascript / typeahead.js

typeahead.js is a fast and fully-featured autocomplete library
https://typeahead.js.org/
MIT License
967 stars 231 forks source link

'Query search for matches issue' with Trie data structure #42

Open zenithtekla opened 8 years ago

zenithtekla commented 8 years ago

Simply put, this Git source hasn't fixed the issue that could be described as:

With Bloodhound engine data to search for California, we type 'c' and retrieves the state with typeahead (54 states data). but typing 'l', 'i', 'for', 'li',... does not include California as a selective option or even nothing found. Try it here with all examples EXCEPT for the very first one.

Source: my post at Twitter Typeahead git (search_index.js) If your version based off this stale version, please have a look at my raised concern: https://github.com/twitter/typeahead.js/commit/7ed93f9#commitcomment-14598011

If the problem is on Trie data structure, could you change the node data method in search_index.js so as to fix it?

zenithtekla commented 8 years ago

In a further research about trie data structure, I found this http://jsfiddle.net/4Yttq/1/ but don't fully understand it so as to fix the problem with matching of only first character in the combo typeahead-bloodhound.

zenithtekla commented 8 years ago

Maybe, the solution is to twist it and apply the multi-way Tries

sheeley commented 8 years ago

There do appear to be a few ternary trie javascript implementations - would you like to take a look and send a PR this way? It looks like the change wouldn't be overly complicated.

zenithtekla commented 8 years ago

Problem is that I don't know anything about Trie data structure, and so I couldn't implement it the right way because I m not good at writing JS library.