Repository navigation
|
I use Fuse to filter a database. I want to search among names and translations.other_language So if I type Apple I can have an object with Apple as a name, but if I type "Pomme" I can also have the same object (thanks to the French translation). Now I would like to know if the item found, has been found the "name" or with "translations.FR". |
Answered by
krisk
Apr 3, 2026
Replies: 2 comments
|
Difficult to help here without seeing what a sample data object looks like, and possibly what you've tried to do. |
0 replies
|
Adding a better answer to my earlier reply — yes, this is possible. Set 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 |
0 replies
Answer selected by
krisk
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adding a better answer to my earlier reply — yes, this is possible. Set
includeMatches: truein your options, and each result will include amatchesarray that tells you which key was matched:Each entry in
matcheshas akeyproperty indicating which field produced the match.