krisk / Fuse

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

Threshold isn't workiing as expected #748

Closed TJMaria closed 2 months ago

TJMaria commented 7 months ago

Is there an existing issue for this?

Description of the bug

const options = {
    includeScore: true,
    isCaseSensitive: false,
    threshold: 0.35,
    ignoreLocation: true,
  };

  const fuse = new Fuse(list, options);

I'm using v7.0.0

Using the above options, threshold at 0.35, i'm getting results with scores of 0.388 and 0.422. When changing the threshold to 0.33, these results are filtered out.

Am I misunderstanding how the threshold works?

The Fuse.js version where this bug is happening.

6.6.2

Is this a regression?

Which version did this behavior use to work in?

None

Steps To Reproduce

Use the following options:

const options = {
    includeScore: true,
    isCaseSensitive: false,
    threshold: 0.35,
    ignoreLocation: true,
  };

And try to filter out results based on score threshold.

Expected behavior

Filter out results based on score threshold

Screenshots

No response

Additional context

No response

github-actions[bot] commented 3 months ago

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