servicerunner: fuzzy match
Original commit message(s)
- servicerunner: fuzzy match
use a bitap implementation instead of doing awkward contains dances. this should lead to somewhat more reliable results, which are now more comprehensively asserted in the unit test
at the heart of this is a new fuzzyScore function that assigns a score to a service vis a vis a query. this score is adjusted depending on which field it is regarding (name > genericname > keywords). this should hopefully ensure that a match against name outweighs most other matches. all scores are eventually assembled into a final score that gets used as match relevance
Reason for the change
matching services is a bit of an art and we didn't do it very artful. the previous code wasn't particularly flexible when it came to typos or partial matching. the hope is that fuzzy matching gives better results throughout while also simplifying the matching logic because we can simply rely on fuzzy scoring to give us reliable relative scores.
this uses very conservative fuzzy metrics (amount of allowed permutations etc) - something we could revisit in the future.
Test plan
tests pass. one test is currently disabled because it is actually broken on a preexisting level
a new test has been added for a notorious mix of code editors
Screenshots or screen recordings
n/a
Bugs fixed
n/a