krisk / Fuse

Lightweight fuzzy-search, in JavaScript
https://fusejs.io/
Apache License 2.0
17.76k stars 753 forks source link

fix: do not return partial matches for threshold 0 #766

Open RomanHotsiy opened 1 month ago

RomanHotsiy commented 1 month ago

Fixes https://github.com/krisk/Fuse/issues/762

RomanHotsiy commented 1 month ago

Hey @krisk 🙌

Thanks for the great lib! I hit one problem and noticed it was already reported https://github.com/krisk/Fuse/issues/762 so I decided to fix it.

The fix is one-liner and I added a unit test to cover it.

Please, let me know if you want me to adjust something or if you feel this is not a good fit in general (so I will maintain a fork or implement a workaround on top). Thanks in advance!

swithek commented 1 week ago

@krisk Are there any plans to merge this? The project I'm working on is affected by this problem too.

NicolasDurant commented 5 days ago

Having the same issue and this PR fixes it, if changed locally in my node_modules. Would be great, if this could be merged.

Although to my understanding there could be still multiple indices returned as in my case, where I have a very long string that can contain the exact string match multiple times. So, the test of this PR could be updated to reflect that.