-
Notifications
You must be signed in to change notification settings - Fork 63
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
FindFrom return another struct value? #11
Comments
Hey - These are great questions :)
Interesting. I would suggest normalising the input before passing it to
The results are purposefully not limited because we need to scan the entire search space to find the best matches so might as well return all the matches. The way you're limiting results in fine. The only downside of this approach is the potential for excessive heap use when dealing with huge search lists. Hope this helps. Feel free to ask any other questions or suggest features. Thanks! |
Thanks for the quick response
for _, r := range results {
fmt.Println(r.Str)
}
Thanks again! |
Sorry this was me being dumb. The result contains an index. So this should work. results := fuzzy.FindFrom("al", emps)
for _, r := range results {
fmt.Println(emps[r.Index])
} I've updated the README to show this.
👍
I wouldn't worry too much right now. It might be a problem if you start hitting millions of results. |
Somehow I managed to miss that one when I looked at the code. Thanks again! |
Fairly new to go, just have a question about the FindFrom function.
Edit: After playing with it a bit more...
I am trying to use this as an auto complete in a react app. I noticed when imputing a quotation mark, on my computer it is U+0022 (Standard straight quotation mark) but when entering on my phone the value is U+201D ” (Right double quotation mark) and the search on my phone will not match my data. Would if be worth it to make U+0022,U+201C,U+201D equal when searching?
Is there a more elegant way to limit the search results than this? maybe the FindFrom function could have a functional option to limit the result?
The text was updated successfully, but these errors were encountered: