From 292017d7bddf1fd3f0417d8ea77fb0be1733742d Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Fri, 29 Sep 2023 17:36:19 +0100 Subject: [PATCH] AK/FuzzyMatch: Use a first letter bonus of 15 rather than 20 This matches the value used in the original `lib_fts` implementation of the algorithm. --- AK/FuzzyMatch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AK/FuzzyMatch.cpp b/AK/FuzzyMatch.cpp index f82db25af5..7033c458df 100644 --- a/AK/FuzzyMatch.cpp +++ b/AK/FuzzyMatch.cpp @@ -17,7 +17,7 @@ static constexpr int const MAX_MATCHES = 256; static constexpr int const SEQUENTIAL_BONUS = 15; // bonus for adjacent matches (needle: 'ca', haystack: 'cat') static constexpr int const SEPARATOR_BONUS = 30; // bonus if match occurs after a separator ('_' or ' ') static constexpr int const CAMEL_BONUS = 30; // bonus if match is uppercase and prev is lower (needle: 'myF' haystack: '/path/to/myFile.txt') -static constexpr int const FIRST_LETTER_BONUS = 20; // bonus if the first letter is matched (needle: 'c' haystack: 'cat') +static constexpr int const FIRST_LETTER_BONUS = 15; // bonus if the first letter is matched (needle: 'c' haystack: 'cat') static constexpr int const LEADING_LETTER_PENALTY = -5; // penalty applied for every letter in str before the first match static constexpr int const MAX_LEADING_LETTER_PENALTY = -15; // maximum penalty for leading letters static constexpr int const UNMATCHED_LETTER_PENALTY = -1; // penalty for every letter that doesn't matter