Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

philwolstenholme
Copy link

@philwolstenholme philwolstenholme commented May 6, 2016

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:

@philwolstenholme
Copy link
Author

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 public/index.html all seem to be functioning. Are there any more thorough tests I could run to help get this PR merged 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)

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

@mariusa
Copy link

mariusa commented Mar 20, 2017

@koenpunt Would it be possible to please merge this?
It would solve multiple open issues for multiple words search. Thanks!

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)
Copy link

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.

@Mikk3lRo Mikk3lRo mentioned this pull request Oct 1, 2017
5 tasks
@eterry1388
Copy link

Can we get this merged in? What is it waiting on?

@Dave-Smith
Copy link

Is there a plan to merge this? It would be super helpful for us.

@JoseWhite
Copy link

why wasn't this merged? need it badly

@bhartvigsen
Copy link

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants