I'm trying to use Fuse JS to do a fuzzy search on a list of strings but the results it's giving back don't make sense. I've set up a playcode here as an example.
Here my list is
[
"Yoga with Adriene - Revolution",
"Brewdog beers",
"NBA teams seen live",
"Yoga with Adriene - DEDICATE - 30 days",
"Yoga with Adriene - home",
]
My code config is
const options = {
isCaseSensitive: false,
includeScore: true,
shouldSort: true,
};
When I search with search term 'yoga home' The closest match returned is 'Brewdog beers' which is clearly the worst search result, I'm expecting it to return the 'Yoga with Adriene - home' result first with 2 words matching. The results are:
[
{
"item": "Brewdog beers",
"refIndex": 1,
"score": 0.6932183529538054
},
{
"item": "Yoga with Adriene - Revolution",
"refIndex": 0,
"score": 0.6959441913889373
},
{
"item": "Yoga with Adriene - home",
"refIndex": 4,
"score": 0.6959441913889373
},
{
"item": "Yoga with Adriene - DEDICATE - 30 days",
"refIndex": 3,
"score": 0.7504597227725356
}
]
Where a score of 0 is an exact match.