diff options
author | Phil Jones <philj56@gmail.com> | 2022-09-07 14:20:59 +0100 |
---|---|---|
committer | Phil Jones <philj56@gmail.com> | 2022-09-07 14:34:39 +0100 |
commit | adc683b7fa847bc1776e3bece532c39aff12b039 (patch) | |
tree | 73e1550421a7833c5d9d843c7bcdf1a070fdc7ef /src/desktop_vec.c | |
parent | e72f81799b1184d6b1b1bf8f70ec32d9cc139556 (diff) |
Allow space-separated, per-word matches.
Diffstat (limited to 'src/desktop_vec.c')
-rw-r--r-- | src/desktop_vec.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/desktop_vec.c b/src/desktop_vec.c index 5d63390..df4218b 100644 --- a/src/desktop_vec.c +++ b/src/desktop_vec.c @@ -150,14 +150,9 @@ struct string_vec desktop_vec_filter( for (size_t i = 0; i < vec->count; i++) { int32_t search_score; if (fuzzy) { - search_score = fuzzy_match(substr, vec->buf[i].name); + search_score = fuzzy_match_words(substr, vec->buf[i].name); } else { - char *c = strcasestr(vec->buf[i].name, substr); - if (c == NULL) { - search_score = INT32_MIN; - } else { - search_score = vec->buf[i].name - c; - } + search_score = fuzzy_match_simple_words(substr, vec->buf[i].name); } if (search_score != INT32_MIN) { string_vec_add(&filt, vec->buf[i].name); @@ -170,14 +165,9 @@ struct string_vec desktop_vec_filter( } else { /* If we didn't match the name, check the keywords. */ if (fuzzy) { - search_score = fuzzy_match(substr, vec->buf[i].keywords); + search_score = fuzzy_match_words(substr, vec->buf[i].keywords); } else { - char *c = strcasestr(vec->buf[i].keywords, substr); - if (c == NULL) { - search_score = INT32_MIN; - } else { - search_score = vec->buf[i].keywords - c; - } + search_score = fuzzy_match_simple_words(substr, vec->buf[i].keywords); } if (search_score != INT32_MIN) { string_vec_add(&filt, vec->buf[i].name); |