The Match Strategy sequence
mainThe fuzzy matching engine follows a specific sequence of checks to determine the best score for a candidate:
- Exact match: Returns score 1.0 immediately.
- Prefix edit distance: Computes distance from the start of the string.
- Substring edit distance: Computed only if the prefix score is < 0.7 and prefix distance != 0.
- Position bonuses: Applies bonuses for matches at word boundaries.
- Subsequence matching: If no edit distance match is found, attempts subsequence matching with bonuses.
- Acronym matching: For short queries (2-8 chars), attempts matching against word initials.
- Threshold check: Returns the best score found, provided it is above the
minScorethreshold.