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

What is distance and location? #391

Closed
ergcode opened this issue Apr 12, 2020 · 3 comments
Closed

What is distance and location? #391

ergcode opened this issue Apr 12, 2020 · 3 comments
Labels

Comments

@ergcode
Copy link

ergcode commented Apr 12, 2020

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.

@calirvine
Copy link

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.

@krisk
Copy link
Owner

krisk commented Apr 23, 2020

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.

@krisk krisk closed this as completed Apr 26, 2020
@krisk
Copy link
Owner

krisk commented Jun 25, 2020

Update: the option to ignore has been implemented

(see: #438 and #440)

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

3 participants