-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: change search function from list.js to fuse.js #1653
Conversation
A couple of questions:
|
I rebased your branch, so only 2-3 things are left above :) EDIT: Oh, actually I can't push to your branch... |
I changed it temporarily to avoid a conflict during the rebase. I just re-enabled it, so you can just pull my branch and push changes again. |
Thank you for your contributions as usual! I updated my questions in my previous post. |
|
Sounds good thanks! So, I think it looks really good, love it ❤️ If we could go with the basic fuse.js build, that would be the best but if it's causing us issues, no big deal. Debouncing maybe can be implemented later if you don't have time; search is fast it's just it's good practice to debounce things when we know there will be some delay. As for sorting, I'm seeing weird sorting. I'm not saying it's wrong but it wort of feels weird. Must be fuse's filter score thing or something. Maybe since it's the default we should leave it for now, though. |
Just added debouncing. |
docs/assets/js/search.js
Outdated
@@ -45,7 +45,11 @@ | |||
window.history.replaceState(null, null, newUrl) | |||
} | |||
|
|||
searchInput.addEventListener('input', () => search(searchInput.value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use let
. At some point I need to backport the eslint config from the main repo...
Now, regarding your solution, maybe https://levelup.gitconnected.com/debounce-in-javascript-improve-your-applications-performance-5b01855e086 ?
Maybe it's fuzzy matching in effect https://fusejs.io/api/options.html#threshold or We could leave it as is, it's not bad per se, it's just different from what we had. |
Oh, and it's seems |
Yes, the sorting was using the filter scoring. I think it's better to see similar icons grouped together than to see which icon matches your search the most so I changed it. The sorting is now just like with the old search. |
Fuzzy search is currently disabled ( |
use debounced fuse.js extended search in search function
Cool, let's land this and we can improve it later. Do not hesitate to submit a PR and CC me later :) |
As discussed in #1432 (comment). Already includes the changes from #731.
Does not affect search performance (maybe improves it by a bit, but no significant changes [~100ms -> ~50ms]).
There is no difference to the original search results, except for search terms which use the 'extended search' features of fuse.js.
Preview: