Commit ef62ffdd authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Score fully in sequence matches higher if pattern len >= 4

If pattern is >= 4 and an exact match happens, score it higher.

Doing it for smaller strings might lead to worse results as the shorter
a string is, the more likely it is that it will be part of some other
string.

BUG: 455865
parent f5be14cb
Pipeline #196754 passed with stage
in 5 minutes and 26 seconds
......@@ -258,6 +258,7 @@ static bool fuzzy_internal::fuzzy_match_recursive(QStringView::const_iterator pa
i++;
}
bool allConsecutive = true;
// Apply ordering bonuses
for (; i < nextMatch; ++i) {
const uint8_t currIdx = matches[i];
......@@ -272,6 +273,8 @@ static bool fuzzy_internal::fuzzy_match_recursive(QStringView::const_iterator pa
// In sequence, but not from first char
outScore += nonBeginSequenceBonus;
}
} else {
allConsecutive = false;
}
}
......@@ -292,6 +295,10 @@ static bool fuzzy_internal::fuzzy_match_recursive(QStringView::const_iterator pa
outScore += separatorBonus;
}
}
if (allConsecutive && nextMatch >= 4) {
outScore *= 2;
}
}
totalMatches = nextMatch;
......
Supports Markdown
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