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

ignoreLocation when useExtendedSearch = true #465

Closed
Kjetiljv opened this issue Jul 7, 2020 · 6 comments
Closed

ignoreLocation when useExtendedSearch = true #465

Kjetiljv opened this issue Jul 7, 2020 · 6 comments

Comments

@Kjetiljv
Copy link

Kjetiljv commented Jul 7, 2020

Hi!

I had an issue where I did not get the expected search results due to some strings being way longer than others.
I updated Fuse to the latest version when the ignoreLocation flag was introduced and this solves the issue if I dont enable useExtendedSearch. However, if I set it to true it looks like ignoreLocation is no longer relevant and I fall back to the default values for location and distance.

Is this expected behavior when using extended search?

@krisk
Copy link
Owner

krisk commented Jul 13, 2020

Thanks for flagging. Do you have sample data + fuse setup to replicate the issue?

@Kjetiljv
Copy link
Author

Kjetiljv commented Jul 16, 2020

Tested this on the live demo. It will return the item in list.json As expected since it matches on apple. But if you change useExtendedSearch: true The result array will be empty.

List.json
[ { "document": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum apple." }, ]

Main.js

const options = {
  // isCaseSensitive: false,
  // includeScore: false,
  // shouldSort: true,
  // includeMatches: false,
  // findAllMatches: false,
  // minMatchCharLength: 1,
  // location: 0,
  threshold: 0.2,
  // distance: 100,
  useExtendedSearch: false,
  ignoreLocation: true,
  // ignoreFieldNorm: false,
  keys: [
    "document",
  ]
};

const fuse = new Fuse(list, options);

// Change the pattern
const pattern = "Apple"

return fuse.search(pattern)

@NevenLiang
Copy link

NevenLiang commented Aug 5, 2020

Same issue here. This is my code sandbox.

When useExtendedSearch is set to true and only using fuzzy search in pattern, the setting ignoreLocation doesn't work. After I set distance to 3000, I can search callback in result.

@github-actions
Copy link

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

@github-actions github-actions bot added the Stale label Sep 11, 2020
@Kjetiljv
Copy link
Author

Kjetiljv commented Sep 15, 2020

Just a comment to prevent closing.

@vayyala
Copy link

vayyala commented Oct 29, 2020

Also running into this issue. We've turned off useExtendedSearch for now because of it, but would love to use it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants