Commit c7b32006 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Use constexpr in fuzzy_match_recursive for score calculation

parent 45571779
...@@ -124,14 +124,14 @@ namespace kfts { ...@@ -124,14 +124,14 @@ namespace kfts {
// Calculate score // Calculate score
if (matched) { if (matched) {
const int sequential_bonus = 15; // bonus for adjacent matches static constexpr int sequential_bonus = 15; // bonus for adjacent matches
const int separator_bonus = 30; // bonus if match occurs after a separator static constexpr int separator_bonus = 30; // bonus if match occurs after a separator
const int camel_bonus = 30; // bonus if match is uppercase and prev is lower static constexpr int camel_bonus = 30; // bonus if match is uppercase and prev is lower
const int first_letter_bonus = 15; // bonus if the first letter is matched static constexpr int first_letter_bonus = 15; // bonus if the first letter is matched
const int leading_letter_penalty = -5; // penalty applied for every letter in str before the first match static constexpr int leading_letter_penalty = -5; // penalty applied for every letter in str before the first match
const int max_leading_letter_penalty = -15; // maximum penalty for leading letters static constexpr int max_leading_letter_penalty = -15; // maximum penalty for leading letters
const int unmatched_letter_penalty = -1; // penalty for every letter that doesn't matter static constexpr int unmatched_letter_penalty = -1; // penalty for every letter that doesn't matter
// Iterate str to end // Iterate str to end
while (!str->isNull()) while (!str->isNull())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment