-
Notifications
You must be signed in to change notification settings - Fork 21
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
Update Fuse.js configuration to adjust search threshold #3288
Update Fuse.js configuration to adjust search threshold #3288
Conversation
✅ Deploy Preview for ons-design-system-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
The description now needs updating with the latest changes |
Co-authored-by: rmccar <[email protected]>
Co-authored-by: rmccar <[email protected]>
I think there may be an issue with this not working as expected, I upped the threshold to 0.8 in the example and was still getting the same results. So you may need to make sure that is being passed into the config correctly |
@precious-onyenaucheya-ons @rmccar Sorry, I ran out of time to look at this on Friday after running into some git permission issues Precious is aware of but I wanted to take a look before you have stand up in the morning. I'm not sure if I've misunderstood the ticket and the requirements - it wasn't entirely clear for me but this doesn't look like it's working to me. Could be I'm not looking at it correctly but once I hit around 32 characters in the search box it no longer returns the results I'd expect. I've taken some screen shots to illustrate what I experienced.
I tried playing with the thresholds but this didn't seem to make any difference to the issues I've described above. |
I'd also like to second @admilne's findings. I've also done some additional testing with some of my own examples. In this picture, you can see Characters does not return anything in this scenario This might seem like an edge case but say there was a scenario where a user wanted to match this: Ultra HD 4K Smart Television Model XYZ1234567890 based on the model number which is outside of 32 characters You can test my changes in: feature/3282/increase-search-threshold-adi Edit: Actually in even more testing, back to the original example (testing in countries-multiple), if you type "sandwich islands", you'd expect "South Georgia and the South Sandwich Islands" to appear but nothing appears Edit 2: Even weirder, if you search for "thi" in the search box in my example, you get matches for "thi" beyond 32 characters? Not sure if this is because its previously matched "thi" at the beginning. |
These issues seem to be fixed by changing the distance to 500 in my testing without changing the threshold at all. So maybe we need to parameterise the distance not the threshold. But the issues Andrew highlighted still seem to be an issue. There might be an issue with the length of the query string entered which would cause the issues Andrew has found. This all needs bit more testing to make sure we get a balance between the distance and threshold. Testing with ignoreLocation might also be something we want to look into. |
82a91f2
to
89a0469
Compare
053d19e
to
39aaa99
Compare
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.
LGTM and looks like it's working as expected
What is the context of this PR?
This PR fixes #3347
This PR updates the Fuse.js configuration to address an issue where only the first 30 characters in the list seem to be searched.
The previous threshold setting of 0.2 was too restrictive, causing the search to miss relevant entries when queries became longer. With this update, users can now set the search threshold between 0 and 1, allowing for greater flexibility and improving search accuracy across different query lengths.
How to review this PR
Describe the steps required to test the changes (include screenshots if appropriate).
Checklist
This needs to be completed by the person raising the PR.