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

[Dropdown] - fullTextSearch: true does not properly filter values #3085

Closed
jaimehing opened this issue Sep 24, 2015 · 12 comments
Closed

[Dropdown] - fullTextSearch: true does not properly filter values #3085

jaimehing opened this issue Sep 24, 2015 · 12 comments

Comments

@jaimehing
Copy link

Expected
I was expecting being filtered here are
ANC - Acta Numerica
DRJ - Dance Research Journal

Result
Please see screenshot:
snip20150924_1

I think the search dropdown doesn't filter the exact values you've typed anywhere from the string.

P.S. I'm filtering via text and not via values.

@scoman81
Copy link

Not sure if you just typo'd in the title or not, but the setting value is "searchFullText" not "fullTextSearch"

@jaimehing
Copy link
Author

Hi,

this is what I'm seeing from your documentation:

snip20150924_2

@furins
Copy link

furins commented Sep 24, 2015

same issue here (SUI 2.1.4).

I confirm that the correct setting should be "fullTextSearch": "searchFullText" is meant for search components. This double wording be also the cause of the problem, by the way.

another setting that is not taken in account, apparently is match.
here is my code (sortSelect works, I've added this setting just to be sure that the dictionary is parsed) :

$('#id_element').dropdown({fullTextSearch:true, sortSelect: true, match:'text'});

in my example code the actual result is a select tag converted into a searchable dropdown, with sorted options that are searched (erroneously, apparently) both for values and text and only at the beginning of the string.

@scoman81
Copy link

You're right - I was looking at the search code, not the dropdown code. My mistake!

The option naming isn't consistent, and the fuzzySearch() function is confusing as all get-out, but my first inclination is that considering how amazing the rest of this library is, the author must have their reasons. Hopefully he'll comment at some point. (I'd be super interested to know why .indexOf() isn't good enough after forcing case.)

@jlukic
Copy link
Member

jlukic commented Sep 25, 2015

The naming difference between dropdown/search fullTextSearch and searchFullText was a mistake. But unfortunately you get stuck with those for backwards compatibility.

I might consider adding a setting alias and removing in 2.0.

Fuzzy search is an algorithm designed to return results even with common input mistakes.

@furins I haven't written a match setting for dropdown, but if you'd like to suggest it in a separate thread I can mark it with a milestone.

@jaimehing
Copy link
Author

so @jlukic, what can you suggest to solve my issue?

@jlukic
Copy link
Member

jlukic commented Sep 28, 2015

This is the intended behavior with full text search.

Fuzzysearch

The method will return true only if each character in the needle can be found in the haystack and occurs after the preceding matches.

If someone wants to implement fullTextSearch: 'exact' and fullTextSearch: 'fuzzy' as an option I would accept that PR. fullTextSearch: true in that case should evaluate same as fullTextSearch: 'fuzzy'

@furins
Copy link

furins commented Sep 28, 2015

@jlukic ok for the match setting, I'll do it.

but still I have the issue with fullTextSearch (fuzzy). It does not seems to search the way you described, it search only at the beginning of the string. (in search components fuzzysearch algorithm works as expected). Now I'm at work so I cannot prepare a full test case/example. I'll try to do it tomorrow.

@jaimehing
Copy link
Author

hi @furins do you have updates on implementing fullTextSearch exact or fuzzy? I need this feature and I'd like to help

jlukic added a commit that referenced this issue May 15, 2016
jlukic added a commit that referenced this issue May 15, 2016
@daneren2005
Copy link

It has been over a year since this was first opened. Is this every going to be merged into master so we can actually use this? The fuzzy matching is fairly flawed and really all I want is similar to those commits where it does a lower case match.

@daneren2005
Copy link

daneren2005 commented Nov 21, 2016

Ignore my earlier comment. It appears that it already has been merged (I searched for "exact" instead of 'exact' in the changelog). It appears to only work correctly if match: 'text' even when there is no value attribute on the options:

http://jsfiddle.net/daneren2005/efp8z6Ln/400/
Type in 108910 and it filters correctly. Comment out match: text and try it again and it doesn't filter correctly.

@stale
Copy link

stale bot commented Feb 23, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 23, 2018
@stale stale bot closed this as completed Mar 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants