Switched to summing exec and name matches in the Applications plugin

This commit is contained in:
Kirottu
2023-04-14 08:31:03 +03:00
parent 78acd78d66
commit 08114309a3

View File

@@ -55,10 +55,14 @@ pub fn get_matches(input: RString, entries: &mut Vec<(DesktopEntry, u64)>) -> RV
.clone()
.into_iter()
.filter_map(|(entry, id)| {
matcher
.fuzzy_match(&entry.name, &input)
.max(matcher.fuzzy_match(&entry.exec, &input))
.map(|val| (entry, id, val))
let score = matcher.fuzzy_match(&entry.name, &input).unwrap_or(0)
+ matcher.fuzzy_match(&entry.exec, &input).unwrap_or(0);
if score > 0 {
Some((entry, id, score))
} else {
None
}
})
.collect::<Vec<_>>();