solid-select icon indicating copy to clipboard operation
solid-select copied to clipboard

Fuzzy sort on more than one key

Open xypnox opened this issue 2 years ago • 3 comments

In the usual scenarios, having a single key to sort the list of data is fine, however, it might be useful to have an array of keys that can be used to match for the fuzzy finder and the higher match score will be used.

xypnox avatar May 25 '23 11:05 xypnox

Do you have a specific use case in mind? I try to keep solid select opinionated but extensible so cautious in adding more "builtin". Would be good to see an example to play with.

martinpengellyphillips avatar Jun 05 '23 19:06 martinpengellyphillips

A few cases come to my mind,

  1. The initial use case that I had was matching a nested set of links by either their entire path or by their name. a.b.c matches with abc and c
  2. Matching name / description of a object
  3. Matching category/name of a object

Sorry for the late reply.

xypnox avatar Jun 17 '23 06:06 xypnox

I think it would be useful, but rather than increase the core size of this library I would recommend in your case to integrate a dedicated fuzzy search/sort library. So maybe this is more about providing a more composable way to add own search sort function to the createOptions helpers 🤔

martinpengellyphillips avatar Aug 13 '23 09:08 martinpengellyphillips

Release 0.15.0 has now been published which makes this easier, though does not yet build in a multi-field fuzzySort. However, you can check out the new example on the website that shows one approach to do this: https://solid-select.com/?example=Filterable%2520%28Custom%29

martinpengellyphillips avatar Jul 06 '24 22:07 martinpengellyphillips