Example: Go to the demo at http://fusejs.io/, click "Include score", change the Keys array to ["title","author.firstName","author.lastName"], and search for "wood".
"The Code of the Wooster" should appear at the top, as not only would it have a 0.001 score based on author.lastName ("Woodhouse"), it would also have a 0.41 score based on title (the highest-ranking book based on a title search alone).
"The Code of the Wooster" comes in third with a score of 0.2055, with the 0.41 match on title seemingly being averaged with the 0.001 score from author.lastName, putting it below the other books by Woodhouse that do not score highly on title.
Suggested fix: multiple fuzzy-match results should be multiplied, not averaged - an object with a 0.001 match on one field and a 0.41 match on another field should have a resulting score of 0.00041 (putting it 0.00059 above an object with a 0.001 match alone), not 0.2055.
@stuartpb good analysis. Will make the necessary changes.
I disagree with multiplication. I think addition is better (or averaging, same thing).
The reason is because when a user searches for "wood", they are intending the logic "title contains wood" OR "name contains wood". If both the statements are true, it makes sense to roughly double the score.
If the user was intending "title contains wood" AND "name contains wood", the score should be the product of the individual scores. But this is not what the user intends when they are trying to find a needle ("wood") in a haystack ("The Code of the Wooster by Woodhouse").
In fuzzy logic, the AND operator is generalized to multiplication of probabilities x * y, while the OR operator is generalized to x + y - x * y. But since x * y is usually small, x + y is a good approximation and actually has better properties in the application of fuzzy string searching.
Most helpful comment
Suggested fix: multiple fuzzy-match results should be multiplied, not averaged - an object with a 0.001 match on one field and a 0.41 match on another field should have a resulting score of 0.00041 (putting it 0.00059 above an object with a 0.001 match alone), not 0.2055.