opt out of certain checking
hozefaj opened this issue · comments
match-sorter
: 2.2.0node
: v8.9.3npm
(oryarn
) version: 5.7.1
Problem description:
Is there a way to opt out of certain checking. Like the use case I have, I do not want CASE ACRONYM
, ACRONYM
& SIMPLE MATCH
being used for comparison. So any items that match these 3 things are omitted from final result.
This is not supported, but I'd happily accept a tested, documented, working PR for it 👍
Sure. Let me give it a shot. Will circle back in few days with a rough design.
I think this is the kind of API I'd like:
matchSorter(otherThings, 'app', {excludeRankings: [matchSorter.rankings.STRING_CASE_ACRONYM, matchSorter.rankings.ACRONYM, matchSorter.rankings.MATCHES]})
Though it just occurred to me that your purposes might be better served by simply doing:
matchSorter(otherThings, 'app', {threshold: matchSorter.rankings.CONTAINS})
This means that if it doesn't at least match well enough as the contains ranking then it wont be considered a match. Does that work for you?
Yup matchSorter(otherThings, 'app', {threshold: matchSorter.rankings.CONTAINS})
works perfectly.
I somehow was not able to make sense of what rankings
meant. Your explanation here makes perfect sense.