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
=== modified file 'lib/synapse-plugins/desktop-file-plugin.vala' (properties changed: -x to +x)
--- lib/synapse-plugins/desktop-file-plugin.vala 2014-08-31 12:12:11 +0000
+++ lib/synapse-plugins/desktop-file-plugin.vala 2015-04-27 14:11:17 +0000
@@ -173,7 +173,8 @@
173 // "seto" matching "System Monitor"173 // "seto" matching "System Monitor"
174 foreach (var matcher in matchers)174 foreach (var matcher in matchers)
175 {175 {
176 if (matcher.key.match (folded_title))176 MatchInfo info;
177 if (matcher.key.match (folded_title, 0, out info))
177 {178 {
178 results.add (dfm, compute_relevancy (dfm, matcher.value));179 results.add (dfm, compute_relevancy (dfm, matcher.value));
179 matched = true;180 matched = true;
@@ -185,6 +186,12 @@
185 matched = true;186 matched = true;
186 break;187 break;
187 } 188 }
189 else if (info.is_partial_match ())
190 {
191 results.add (dfm, compute_relevancy (dfm, Match.Score.INCREMENT_SMALL));
192 matched = true;
193 break;
194 }
188 }195 }
189 if (!matched && (comment.down ().contains (q.query_string_folded) 196 if (!matched && (comment.down ().contains (q.query_string_folded)
190 || generic_name.down ().contains (q.query_string_folded)))197 || generic_name.down ().contains (q.query_string_folded)))

Subscribers

People subscribed via source and target branches