Reputation: 124
I am using fuse.js to search in arrays of objects like http://fusejs.io/#searching-in-arrays-of-objects
It returns the whole item with the tag matched. How do I know which of the tags is matched?
Upvotes: 1
Views: 893
Reputation: 4752
When you set your options, set verbose to true. This will log matching scores, with the matched key, to the console.
const options = {
verbose: true,
shouldSort: true,
threshold: 0.6,
location: 0,
distance: 100,
maxPatternLength: 32,
minMatchCharLength: 1,
keys: [
"title",
"author.firstName"
]
};
const fuse = new Fuse(list, options);
Upvotes: 0