Match subsequences in application runner
ClosedPublic

Authored by rthomas on May 15 2017, 4:28 PM.

Details

Summary

Match applications in krunner using subsequences instead of substrings. This allows matching applications using parts of its name, instead of having to type its full name.
This is also an attempt to implement bug #262837 (Applications runner - match subsequence instead of substring)

Examples :


Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
rthomas created this revision.May 15 2017, 4:28 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMay 15 2017, 4:28 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
apol added a subscriber: apol.May 15 2017, 11:16 PM

+1

runners/services/servicerunner.cpp
101

use a foreach

203

splitRef(QLatin1Char(' '))?

rthomas added inline comments.May 16 2017, 3:34 PM
runners/services/servicerunner.cpp
101

I'm skipping the first string in strList because that string has already been accounted for relavace right before the call to increaseMatchRelavance. Relevance is incremented by 0.01 only based on the second string onwards. I don't think you can skip iterations based on indices in a foreach loop.

203

Could you explain why would we want to use splitRef instead of split? I'm not sure I understand the need for it.

davidedmundson added inline comments.
runners/services/servicerunner.cpp
203

split copies the strings.
splitRef creates references to a location within an exitsting string without copying it.

Result is the same but faster.

rthomas updated this revision to Diff 14603.May 16 2017, 3:57 PM
  • Splitting the query using splitRef() instead of split()
  • Using QLatin1Char(' ') as the separator to split the query
rthomas marked 3 inline comments as done.May 16 2017, 3:59 PM
davidedmundson accepted this revision.May 21 2017, 10:53 AM
This revision is now accepted and ready to land.May 21 2017, 10:53 AM

Do you have commit access?

No, I don't have commit access yet. Can I apply for a developer account now? I haven't done so until now.

aacid added a subscriber: aacid.May 27 2017, 4:37 PM

This has no repo assigned, so i was going to commit it but could not.

You can apply for a developer account if you think you need it at https://community.kde.org/Infrastructure/Get_a_Developer_Account

rthomas set the repository for this revision to R120 Plasma Workspace.May 28 2017, 6:11 AM

@aacid : I have assigned the Plasma-Workspace repo to this revision. Please commit this patch on my behalf. I think I'll hold on for a while before applying for commit access.

This revision was automatically updated to reflect the committed changes.