vueform / multiselect

Vue 3 multiselect component with single select, multiselect and tagging options (+Tailwind CSS support).
https://vueform.com
MIT License
808 stars 151 forks source link

Custom search filtering algorithm #313

Closed negezor closed 1 year ago

negezor commented 1 year ago

Can we implement a custom search filtering algorithm? I would like to use fuzzy search, however this is not the only possible filtering option.

As far as I understand, changes need to be made here. And apparently we could normalize search.value once. https://github.com/vueform/multiselect/blob/50ea5dcae01b75b484fbe8a915fa76d8a9479d41/src/composables/useOptions.js#L514-L520

leeoniya commented 1 year ago

https://github.com/leeoniya/uFuzzy#a-biased-appraisal-of-similar-work

adamberecz commented 1 year ago

Added searchFilter option to allow customised search algorithm in 2.6.0.

rafalolszewski94 commented 1 year ago

Could you provide example? This doesn't seem to be documented well.

entioentio commented 1 year ago

It seems that this is done in the filterOptions function in useOptions composable.

    fo = fo.filter(filter)

Bummer, there's no current value of search input available, so you really have to implement everything yourself. I'll see if I can find some time for a PR. @adamberecz you think it's a good idea or isn't it an appreciated feature?