Skip to content
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

Exact matches on arrays of objects result in score higher than 1 #756

Open
1 of 2 tasks
erquhart opened this issue Jan 22, 2024 · 3 comments
Open
1 of 2 tasks

Exact matches on arrays of objects result in score higher than 1 #756

erquhart opened this issue Jan 22, 2024 · 3 comments
Labels

Comments

@erquhart
Copy link

erquhart commented Jan 22, 2024

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

@erquhart
Copy link
Author

@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?

Copy link

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 30 days

@github-actions github-actions bot added the Stale label May 26, 2024
@erquhart
Copy link
Author

Still an issue.

@github-actions github-actions bot removed the Stale label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant