Skip to content
Discussion options

You must be logged in to vote

Adding a better answer to my earlier reply — yes, this is possible. Set includeMatches: true in your options, and each result will include a matches array that tells you which key was matched:

const fuse = new Fuse(list, {
  threshold: 0.3,
  keys: ['name', 'translations.FR'],
  includeMatches: true
})

const results = fuse.search('Pomme')
// results[0].matches[0].key === 'translations.FR'

Each entry in matches has a key property indicating which field produced the match.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by krisk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants