Exact matches on arrays of objects result in score higher than 1
erquhart opened this issue · comments
Is there an existing issue for this?
- I have searched the existing issues
Description of the bug
Matching an entire field exactly results in a seemingly random number, with a very complex decimal, typically somewhere between 1 and 8.
This is not specific to different configurations, it happens just using the defaults.
I've tried versions back to 5.2.1 and the behavior is the same.
The Fuse.js version where this bug is happening.
7.0.0
Note: the issue template only goes up to 6.6.2, had to edit this after creating.
Is this a regression?
- This is a regression bug
Which version did this behavior use to work in?
None
Steps To Reproduce
const fuse = new Fuse([{ name: 'foo' }], { includeScore: true, keys: ['name'] })
fuse.search('fon')
// { ..., score: 0.3333333333333333 }
fuse.search('foo')
// { ..., score: 2.220446049250313e-16 }
Here's a runkit with a repro case: https://runkit.com/erquhart/fuse-exact-match-bug/3.0.0
Expected behavior
Exact match should have a score of 0, as it does when searching against a list of strings.
Screenshots
No response
Additional context
A related issue about this that didn't get any response and was closed as stale: #717
@krisk sorry for the at-mention, I'm just curious if you can shed light. This looks to be happening for multiple major versions. Is there any chance I'm holding it wrong?