I am trying to use fuse.js to search some data but it seems to ignore my key and search the entire item.
I parse a json file with array of data like this. It seems to find words any where even the nest key "desc".
[
{
"name": "Kael",
"rarity": "rare",
"stage": "early",
"title": "Early Game Kael Build 1",
"author": "3030030003",
"data": [
{
"label": "Masteries",
"desc": "Some text.",
"image": "https://linktosomeimage.com/image.jpg"
},
{
"label": "Stats and equipment",
"desc": "More text",
"image": "https://linktosomeimage.com/image.jpg"
}
]
},
{
"name": "Other character",
"rarity": "rare",
"stage": "early",
"title": "Some title",
"author": "3030030003",
"data": [
{
"label": "Masteries",
"desc": "Some text with Kael in it.",
"image": "https://linktosomeimage.com/image.jpg"
},
{
"label": "Stats and equipment",
"desc": "More text",
"image": "https://linktosomeimage.com/image.jpg"
}
]
}
]
const fuzzy = new Fuse(guides, {
keys: ['name']
});
const result = fuzzy.search('kael');
It returns expected data but also items that the search term in a key that I don't give, in this dumbed down example I would get both item as result. I can give more info if it is needed.
Thanks,