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

Open
jaimehing opened this Issue Sep 24, 2015 · 11 comments

Projects

None yet

5 participants

@jaimehing

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

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

@jaimehing

Hi,

this is what I'm seeing from your documentation:

snip20150924_2

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

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

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

@jlukic
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'

@jlukic jlukic added the Discussion label Sep 28, 2015
@furins
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

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

@ShawnCholeva ShawnCholeva added a commit to ShawnCholeva/Semantic-UI that referenced this issue May 3, 2016
@ShawnCholeva ShawnCholeva feat(dropdown) add exact search - #3085 3e6a37f
@jlukic jlukic added a commit that referenced this issue May 15, 2016
@jlukic jlukic Match formatting #3085 f87ae3d
@daneren2005

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
daneren2005 commented Nov 21, 2016 edited

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment