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

Extended search does not provide all matched tokens in matches #390

Closed
chengyin opened this issue Apr 10, 2020 · 1 comment
Closed

Extended search does not provide all matched tokens in matches #390

chengyin opened this issue Apr 10, 2020 · 1 comment
Milestone

Comments

@chengyin
Copy link

Describe the bug

When the query has multiple tokens, only the matches from the last token is included in returned matches.

Version

5.1.0

Is this a regression?

Yes, although 3.6.2 has a different tokenize API. The results in 3.6.2 would include all matches.

🔬Minimal Reproduction

https://runkit.com/embed/p96hle7l44k6

const Fuse = require("fuse.js");
const objects = [{ title: 'Authors of "Fuse Proof of Concept"' }];

const fuse = new Fuse(objects, {
  includeMatches: true,
  useExtendedSearch: true,
  findAllMatches: true,
  threshold: 0.001,
  distance: 10000000,
  keys: ["title"],
});

const getHighlights = results => results.map((result) =>
  result.matches.map(({ value, indices }) =>
    indices.map(([start, end]) => value.substr(start, end - start + 1))
  )
);

const results = fuse.search("authors fuse proof");
console.log(getHighlights(results));
// → [[["or", "of", "F", "Proof", "of", "o", "p"]]]

(Expecting to see Authors and Fuse in the matches).

@krisk krisk added this to the v5.2.0 milestone Apr 11, 2020
krisk added a commit that referenced this issue Apr 11, 2020
@chengyin
Copy link
Author

Seems like GH parsed my commit message wrong in our private repo. Reopening here.

@chengyin chengyin reopened this Apr 16, 2020
@krisk krisk closed this as completed Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants