Fuse: What is distance and location?

Created on 12 Apr 2020  路  3Comments  路  Source: krisk/Fuse


The search is VERY dependent on these parameters. But at the same time their behavior is completely incomprehensible.
Can I permanently disable these options?
The documentation only takes a few words to describe them.

question

Most helpful comment

Update: the option to ignore has been implemented

(see: #438 and #440)

All 3 comments

I would love to have a way to disable this functionality. As a workaround I just set distance to an arbitrarily large number so that it does not throw off my scores by too much, but it's a pretty silly thing to have to do as a workaround.

The calculation for something to be considered a match (whether fuzzy or exact) takes into account how far the pattern is from the expected location, with a threshold calculation.

For example, consider the following options:

  • location defaults to 0
  • distance defaults to 100
  • threshold defaults to 0.6

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 0.

Using the example from #404, consider the string "The Users page provides many options for adjusting a user, such as SAML". Searching for the pattern "SAML" would not match anything, even though "SAML" occurs in the string. The reason is that with the above defaults, for it to be considered a match it would have to be within 0.6 x 100 = 60 characters away from the expected location. However, "SAML" appears at index 67 (which is 67 characters away from the expected location 0).

As a workaround I just set distance to an arbitrarily large number so that it does not throw off my scores by too much, but it's a pretty silly thing to have to do as a workaround.

Not a silly thing to do. It's the right approach to take.

_Nonetheless, 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._

Update: the option to ignore has been implemented

(see: #438 and #440)

Was this page helpful?
0 / 5 - 0 ratings