Merge lp:~kay20/slingshot/search-with-typo into lp:~elementary-pantheon/slingshot/trunk

Proposed by kay van der Zander
Status: Merged
Approved by: Cody Garver
Approved revision: 520
Merged at revision: 538
Proposed branch: lp:~kay20/slingshot/search-with-typo
Merge into: lp:~elementary-pantheon/slingshot/trunk
Diff against target: 26 lines (+8/-1)
1 file modified
lib/synapse-plugins/desktop-file-plugin.vala (+8/-1)
To merge this branch: bzr merge lp:~kay20/slingshot/search-with-typo
Reviewer Review Type Date Requested Status
elementary Pantheon team Pending
Review via email: mp+257479@code.launchpad.net

Commit message

desktop-files-plugin: fallback to possible matches if available (lp:1029612)

When user types srcatch it will still show scratch

Description of the change

i have added the relative possible match.
this helps the users when making a typo to still show to right application.
for example when typing "srcatch" it will still give u scratch

To post a comment you must log in.
lp:~kay20/slingshot/search-with-typo updated
520. By kay van der Zander

desktop-files-plugin: fallback to possible matches if available.

When user types srcatch it still shows scratch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/synapse-plugins/desktop-file-plugin.vala' (properties changed: -x to +x)
2--- lib/synapse-plugins/desktop-file-plugin.vala 2014-08-31 12:12:11 +0000
3+++ lib/synapse-plugins/desktop-file-plugin.vala 2015-04-27 14:11:17 +0000
4@@ -173,7 +173,8 @@
5 // "seto" matching "System Monitor"
6 foreach (var matcher in matchers)
7 {
8- if (matcher.key.match (folded_title))
9+ MatchInfo info;
10+ if (matcher.key.match (folded_title, 0, out info))
11 {
12 results.add (dfm, compute_relevancy (dfm, matcher.value));
13 matched = true;
14@@ -185,6 +186,12 @@
15 matched = true;
16 break;
17 }
18+ else if (info.is_partial_match ())
19+ {
20+ results.add (dfm, compute_relevancy (dfm, Match.Score.INCREMENT_SMALL));
21+ matched = true;
22+ break;
23+ }
24 }
25 if (!matched && (comment.down ().contains (q.query_string_folded)
26 || generic_name.down ().contains (q.query_string_folded)))

Subscribers

People subscribed via source and target branches