farzher / fuzzysort

Fast SublimeText-like fuzzy search for JavaScript.

Home Page:https://rawgit.com/farzher/fuzzysort/master/test/test.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Negative score makes little sense

wmonecke opened this issue · comments

I am quite confused as to why the score is negative and it says higher is better in the documentation.
If something does not match at all I get a score of 0 in my tests. If it does match I get -4.
How is it then that 0 is better than -4 (higher being better)?

Sorry if this is a silly question I just have thought about this for a while and cant understand it.
Thanks for the amazing library!

no match isn't 0 it's null
a perfect match is 0
any issues subtract from the perfect score of 0

Oh ok this is my bad then because I initialized a score variable as 0 and didn't notice null was returned on no matches.
Thank you for your time!