krisk / Fuse

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

ignoreLocation=true does not apply when useExtendedSearch=true #489

Closed Kijit closed 3 years ago

Kijit commented 3 years ago

Describe the bug

The scoring logic is not ignoring Field Norm when using extended search. When not doing pattern matching, ignoreFieldNorm works as expected but with extendedSearch, it returns results with shorter string scoring higher.

Version

v6.4.0

Is this a regression?

Not sure

🔬Minimal Reproduction

data = [ longest string, longer string, long string];

fuse.search('string');

// with extendedSearch=false & ignoreLocation= true result = [ longest string, longer string, long string];

// with extendedSearch=true & ignoreLocation= true result = [ long string, longer string, longest string ];

Additional context

We are sorting data alphabetically, and so we want to use IgnoreFieldNorm to maintain this order and show matches while ignoring length of strings it matches with.

github-actions[bot] commented 3 years ago

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

p0fi commented 3 years ago

Is this still an issue? It seems the be case for me too!

imnotjames commented 3 years ago

Also seeing this issue. It's a bit of a problem because without the flag the search defaults to only 60 characters

imnotjames commented 3 years ago

6.4.3 fixes this!