rusackas commented on a change in pull request #18662:
URL: https://github.com/apache/superset/pull/18662#discussion_r824442941



##########
File path: 
superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx
##########
@@ -545,7 +589,18 @@ export default function VizTypeGallery(props: 
VizTypeGalleryProps) {
     if (searchInputValue.trim() === '') {
       return [];
     }
-    return fuse.search(searchInputValue).map(result => result.item);
+    return fuse
+      .search(searchInputValue)
+      .map(result => result.item)
+      .sort((a, b) => {

Review comment:
       This is better (and I think is sufficient for the feature), but I wish 
there was a way to avoid using `sort` and instead have this be just one more 
_factor_ in the search result, like the [weight for 
keys](https://fusejs.io/examples.html#weighted-search) that `fuse` supports. 
This might be a bit heavy-handed in terms of search weighting, but... the 
feature works!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to