Skip to content

Commit b5419ed

Browse files
ValentinHCompuIves
authored andcommitted
Dashboard: make the search less fuzzy (codesandbox#1866)
At the moment, the search algorithm is too fuzzy in my opinion. First, it give too much importance to the match being at the beginning of the text. This is why I've increased the distance from 100 (default) to 1000. Then (and more importantly), it accepts matches that are pretty far. For instance, if I search for `"music"` it will match `"MUI icon bug" or even more surprisingly `"unistore-rsm"` 🤔. This is why I've decreased the threshold from 0.6 (default) to 0.1. I came up picking this number after outputting the score of each match. Please try it on your dashboard and let me know if those settings sound reasonable.
1 parent 9b83866 commit b5419ed

File tree

1 file changed

+2
-0
lines changed
  • packages/app/src/app/pages/Dashboard/Content/routes/SearchSandboxes

1 file changed

+2
-0
lines changed

packages/app/src/app/pages/Dashboard/Content/routes/SearchSandboxes/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ const SearchSandboxes = ({ store }) => (
2727
(lastSandboxes === null || lastSandboxes !== sandboxes)
2828
) {
2929
searchIndex = new Fuse(sandboxes, {
30+
threshold: 0.1,
31+
distance: 1000,
3032
keys: [
3133
{ name: 'title', weight: 0.5 },
3234
{ name: 'description', weight: 0.3 },

0 commit comments

Comments
 (0)