-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Support for Fuzzy Searching Strings #2028 rebased against current master branch to fix merge conflict #2599
base: master
Are you sure you want to change the base?
Conversation
A client requested that we added fuzzy search to a field that is using Chosen. I'm using a patched version based on #2028 at the moment, but it would be great if this could get into the master branch of Chosen. I've rebuilt the jQuery version with Grunt and the examples in |
else | ||
regex_anchor = if @search_contains then "" else "^" | ||
regex_flag = if @case_sensitive_search then "" else "i" | ||
new RegExp(regex_anchor + escaped_search_string, regex_flag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chosen used to pass an escaped string here. If search_fuzzy is true, the unescaped string is being escaped in get_tokenized_regex_string
. Else, the unescaped string is being passed directly into the new RegExp – causing an error to be thrown. @StehlikC
@koenpunt Would it be possible to please merge this? |
startpos = option.search_text.search zregex | ||
text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length) | ||
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos) | ||
option.search_text = this.highlight_search_result(regex, zregex, option.search_text, searchText) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this change accidentally indents this line too far.
Can we get this merged in? What is it waiting on? |
Is there a plan to merge this? It would be super helpful for us. |
why wasn't this merged? need it badly |
@philwolstenholme Hey how does this work? I've built your PR and instantiate my chosen like: $('select').chosen({search_fuzzy: true}); It just doesn't work. Am I missing a step? |
Summary
This is @StehlikC's pull request for Support for Fuzzy Searching Strings (#2028) from 2014/2015 rebased against the current master branch of Chosen. It introduces fuzzy search to Chosen.
The merge conflict in #2028 has been cleared up by merging @StehlikC's changes to
get_search_regex
with the changes made in ed0c848.References
This is a rebase of #2028
See also: