Highlight on all matched keys?
tomas opened this issue · comments
Tomás Pollak commented
Hi! Great library, kudos for your work.
I'm not sure if this is the expected behaviour, but fuzzysort isn't returning all the highlighted fields when running a search against multiple keys:
let items = [{ band: 'Pink Floyd', album: 'The Wall' }]
let res1 = fuzzysort.go('pink wall', items, { keys: ['band', 'album'] }); // => Array [] (no results)
let scoreFn = function(a) { return Math.max(a[0]?a[0].score:-1000, a[1]?a[1].score-100:-1000) }
let res2 = fuzzysort.go('pink wall', items, { keys: ['band', 'album'], scoreFn: scoreFn }); // Array [ (2) […] ]
console.log(res2[0]); // => Array [ null, null ]
console.log(res2[0].obj); // => Object { band: "Pink Floyd", album: "The Wall" }
I would like to get the highlighted matches both for band
and album
(at res2[0][0]
and res2[0][1]
). This only seems to work if I search by pink
or wall
independently.
Is there way I can make this work? Thanks in advance.
ヽ◕◡◕✿ノ commented