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() .clone()
.into_iter() .into_iter()
.filter_map(|(entry, id)| { .filter_map(|(entry, id)| {
matcher let score = matcher.fuzzy_match(&entry.name, &input).unwrap_or(0)
.fuzzy_match(&entry.name, &input) + matcher.fuzzy_match(&entry.exec, &input).unwrap_or(0);
.max(matcher.fuzzy_match(&entry.exec, &input))
.map(|val| (entry, id, val)) if score > 0 {
Some((entry, id, score))
} else {
None
}
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();