Open fpintos opened 7 months ago
Suggestion will be to process match indices with this function:
function getNonOverlappingSets(originalSet) {
const sets = [...originalSet];
// Sort the sets by the first element of each set
sets.sort((a, b) => a[0] - b[0]);
let result = [sets[0]];
for (let i = 1; i < sets.length; i++) {
// Get the last set in the result array
let lastSet = result[result.length - 1];
// If the current set does not overlap with the last set, add it to the result
if (sets[i][0] > lastSet[1]) {
result.push(sets[i]);
}
}
return result;
}
Performing a Fuse extended search for 'sao paulo' on an item that contains the text 'SAO PAULO' yields matches for [ [ 0, 2 ], [ 1, 2 ], [ 4, 8 ] ], and format-fuse returns them as SAO, AO an PAULO. Rendering those as shown in the readme causes the UI to show "SAOAO PAULO". Ideally, the resulting value would eliminate overlapping matches.
Example:
Actual:
Expected: