Closed wbobeirne closed 4 years ago
Working as expected.
The reason it's not matching is due to the combination of location
, distance
& threshold
.
Specifically:
location
defaults to 0
distance
defaults to 100
threshold
defaults to 0.6
The calculation for it be considered a match (whether fuzzy or exact) takes into account how far the pattern is from the expected location, with a threshold calculation (see here)
With the above defaults, for it to be considered a match it would have to be within (threshold) 0.6
x (distance) 100
= 60
characters away from the expected location.
However, in your case, "SAML" appears at index 67
.
To address, you can either change distance
to a larger number, or change the threshold
. I would recommend the former.
Separately, I'm working on ways to exclude distance & location from the calculation, so that people don't have to worry about fiddling with these options.
Gotcha, thanks for the explanation. I'm thinking fuzzy search may be overkill for my case, and I should just tackle my problem with a more naive search.
Describe the bug
I was testing out my search implementation, and it was mostly going well until I tried using a specific keyword (in my example case, it was
"SAML"
.) Despite being an exact match in many items in the array, I get no results. Perhaps I'm missing some key configuration, or I'm severely misunderstanding the way Fuse works, but my expectation is that this would be a slam dunk for a search result match.Version
5.1.0
🔬Minimal Reproduction
On the live demo page, this is reproducible with the following:
list.json
main.js