Commit a08ce248 authored by Alexander Lohnau's avatar Alexander Lohnau 💬 Committed by Nate Graham
Browse files

systemsettings runner: Consider KCM keywords for querying

BUG: 445304
FIXED-IN: 5.24
parent 6ff53baf
Pipeline #122941 passed with stage
in 53 seconds
......@@ -153,8 +153,19 @@ void SystemsettingsRunner::matchNameKeywordAndGenericName(Plasma::RunnerContext
relevance += 0.1;
}
} else {
// check if the generic name or description matches
if (!checkMatchAndRelevance(data.value(QStringLiteral("GenericName")), 0.65) && !checkMatchAndRelevance(data.description(), 0.5)) {
continue;
// if not, check the keyowords
const QString &query = ctx.query();
const QStringList keywords = data.value(QStringLiteral("X-KDE-Keywords")).split(QLatin1Char(','));
bool anyKeywordMatches = std::any_of(keywords.begin(), keywords.end(), [&query](const QString &keyword) {
return keyword.startsWith(query);
});
if (anyKeywordMatches) {
relevance = 0.2; // give it a lower relevance than if it had been found by name or description
} else {
continue; // we haven't found any matching keyword, skip this KCM
}
}
}
......
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