cmdk icon indicating copy to clipboard operation
cmdk copied to clipboard

Sort groups in addition to items

Open rorhug opened this issue 9 months ago • 3 comments

The default search function is fuzzy (which makes sense #55) however the order could still be improved. In this example, maybe Figma is a good suggestion for ex but the ones containing "Extension" should definitely rank first.

image

rorhug avatar May 08 '24 14:05 rorhug

I believe this is expected functionality due to the fact they are separate sections and defined by two different Command.Group components in code.https://github.com/pacocoursey/cmdk/blob/13f11c4f918cb4f7eb6254b4087a9cc83928b503/website/components/cmdk/raycast.tsx#L25-L77 I don't think ranking groups and changing their order based on the item's rank would be a good idea as I believe the intention for the group is to allow the user to define static ordering and separation.

I personally would prefer the ordering of groups I have defined in my codebase to always be in that order, upon multiple uses I believe this improves user experience as the groups are always in the same order and "place".

Jamess-Lucass avatar May 10 '24 20:05 Jamess-Lucass

Groups should be sorted. Not sure why they're not… will take a look!

pacocoursey avatar May 19 '24 23:05 pacocoursey

try fix in https://github.com/pacocoursey/cmdk/pull/271

Acring avatar Jun 03 '24 07:06 Acring