Bug 511235

Summary: Substring matches for name or caption that are anchored to the beginning of the string are outscored by inexact fuzzy matches
Product: [Plasma] krunner Reporter: Nate Graham <nate>
Component: generalAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: 4wy78uwh, alexander.lohnau, kdedev, natalie_clarius, sitter, thecaptain
Priority: HI Keywords: regression, usability
Version First Reported In: 6.5.0   
Target Milestone: ---   
Platform: KDE Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=511078
https://bugs.kde.org/show_bug.cgi?id=511237
Latest Commit: Version Fixed/Implemented In: 6.5.2
Sentry Crash Report:

Description Nate Graham 2025-10-27 19:30:25 UTC
For example, search for "term".

Instead of "Konsole" being the top match (because "term" is a substring match for "terminal" and anchored to the beginning of the string), the top results for me are:

- Steam
-  Info Center
- System Monitor
- Welcome Center
- System Settings
- ISO Image Writer
- LibreOffice Writer
- Konsole

Someone else reported largely the same issue in https://www.reddit.com/r/kde/comments/1ofr9ft/the_runner_does_not_immediately_produce_the/
Comment 1 TraceyC 2025-10-27 22:45:41 UTC
On my machine with git-master when I search for "term" I see these, note that Konsole isn't in the list. I'd expect it to be in the top results above Steam. The results are in the same order in Application Launcher

- Termius
- Terminal
- Terminology
- Steam
- WezTerm
- SteamVR
- Chatterino
- Betterbird
Comment 2 Harald Sitter 2025-10-28 00:27:04 UTC
That would mean removing the penalty for generic names
Comment 3 Bug Janitor Service 2025-10-28 01:02:14 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5944
Comment 4 Nate Graham 2025-10-29 20:32:16 UTC
*** Bug 511319 has been marked as a duplicate of this bug. ***
Comment 5 Harald Sitter 2025-10-31 17:21:25 UTC
Git commit e7b91993dfff0214669b7f4f802c5c4ee5b4a30f by Harald Sitter.
Committed on 31/10/2025 at 12:33.
Pushed by sitter into branch 'master'.

servicerunner: aggressively expand scoring system

the previous bonus system wasn't producing very good results when
perfect matches were involved. so, we now track perfect matches (along
with the other properties of a match -- for future use) which allows us
to more aggressively outline the base score we expect a good match to
have with regards to relative order.

at its heart this functions mostly the same. matching produces
scorecards, scorecards are aggregated into weightedcards and those are
then computed. the main difference is a new perfectMatchScore logic. if
a match was perfect (required no substitutions) then we give it serious
base line value relative to their weight. only after that we run the
previous fuzzy scoring logic relying on bitap and levenshtein scores.

the base score makes sure we have accurate ordering of perfect matches
while the fuzzy score makes sure matches within the same base score are
then sorted according to how fuzzy or distant they are
Related: bug 511078, bug 511237

A  +19   -0    runners/services/autotests/fixtures/org.gimp.GIMP.desktop
M  +2    -0    runners/services/autotests/fixtures/org.kde.konsole.desktop
A  +24   -0    runners/services/autotests/fixtures/org.libreoffice.LibreOffice.impress.desktop
M  +44   -2    runners/services/autotests/servicerunnertest.cpp
M  +35   -17   runners/services/servicerunner.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/e7b91993dfff0214669b7f4f802c5c4ee5b4a30f