Bug 406292 - Stale duplicate entries in file search result
Summary: Stale duplicate entries in file search result
Status: RESOLVED FIXED
Alias: None
Product: krunner
Classification: Plasma
Component: filesearch (show other bugs)
Version: 5.13.5
Platform: Ubuntu Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: baloo-bugs-null
URL:
Keywords:
: 434742 434864 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-04-07 10:56 UTC by Holger
Modified: 2021-05-19 17:09 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: Frameworks 5.82 & Plasma 5.22


Attachments
screenshot of stale results featuring deleted 2018 file twice and missing 2019 file (48.34 KB, image/png)
2019-04-07 10:56 UTC, Holger
Details
same search via Alt+F2 (40.96 KB, image/png)
2019-04-10 20:24 UTC, Holger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Holger 2019-04-07 10:56:05 UTC
Created attachment 119280 [details]
screenshot of stale results featuring deleted 2018 file twice and missing 2019 file

SUMMARY
The search of Kickoff presents pairs of old files that have already been deleted.

STEPS TO REPRODUCE
1. File has been created somewhen in 2018 (spreadsheet saved by LO-Calc)
2. At some day, I may have opened it via the recent documents
3. I used to open it about once a month - so it wasn't at the top of the recent any more
4. I opened it via the search by typing a few letters
5. in 2019 I retired the 2018 version and moved it to the backup disk

OBSERVED RESULT
a) The 2019 version wasn't found by search until I explicitly opened it through the recent document.
b) The 2018 is still showing twice, although on clicking, I only results in an error, because the file was deliberately deleted from my desktop.


EXPECTED RESULT
a) Include recent files in regular search results (if they show up in recent, they should be searchable, even if kickoff didn't open them until now).
b) Update the search index on selecting a result and check, that the file is really there.
c) Remove duplicate results from index.

SOFTWARE/OS VERSIONS
Windows: n/a
macOS: n/a
Linux/KDE Plasma: 4.18.0-17-generic
(available in About System)
KDE Plasma Version: 5.13.5
KDE Frameworks Version: 5.50.0
Qt Version: 5.11.1

ADDITIONAL INFORMATION
Comment 1 Holger 2019-04-10 20:24:56 UTC
Created attachment 119342 [details]
same search via Alt+F2

I can shed some light on the duplicates: as the new screenshot of Alt+F2 shows, the files appear in two distinct categories. But as Alt+F1 misses the category labels, it is strange to show them twice.

Also I removed the year from the file-name, so the results for 2019 vanished. Sometimes the File "Burger King.ods" was found for search query "burger king", but not for the query "burger king ods" ... right now, it is not found at all - maybe because I opened so many files that it also dropped out of the "recent history" of Alt+F1 ... I guess LO-Calc keeps an independent history, cause it is still in there, as it was faster/easier, to open a bunch of picutres in gwenview to flood the history.
Comment 2 Bug Janitor Service 2021-02-09 15:19:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/krunner/-/merge_requests/56
Comment 3 Nate Graham 2021-03-22 19:59:44 UTC
*** Bug 434742 has been marked as a duplicate of this bug. ***
Comment 4 Nate Graham 2021-03-24 19:58:53 UTC
*** Bug 434864 has been marked as a duplicate of this bug. ***
Comment 5 Alexander Lohnau 2021-04-28 17:23:22 UTC
Git commit ec725807126cbccf6f04c54be597e22526ae6e8f by Alexander Lohnau.
Committed on 28/04/2021 at 17:18.
Pushed by alex into branch 'master'.

Allow runners to prevent duplicate results

This commit allows the runners to use the id to prevent duplicate
results. For this the X-Plasma-Runner-Unique-Results property is added.
If the runners set this to true the runner name is not prepended to the id and
it is checked if a match with the id already exists before the match is added.

Because the property introduces a behavior change we can not enable it
by default.

In case there are duplicate results the results from the runner which has the X-Plasma-Runner-Weak-Results property
set to true will be removed. Otherwise the results from the first runner
will be used.
FIXED-IN: Frameworks 5.82 & Plasma 5.22

M  +2    -2    autotests/fakerunner.h
A  +7    -0    autotests/metadatafile1.desktop
A  +6    -0    autotests/metadatafile2.desktop
M  +36   -1    autotests/runnermatchmethodstest.cpp
M  +12   -0    src/abstractrunner.cpp
M  +5    -0    src/abstractrunner.h
M  +2    -0    src/abstractrunner_p.h
M  +9    -0    src/data/servicetypes/plasma-runner.desktop
M  +8    -2    src/dbusrunner.cpp
M  +1    -0    src/dbusrunner_p.h
M  +9    -7    src/querymatch.cpp
M  +25   -4    src/runnercontext.cpp

https://invent.kde.org/frameworks/krunner/commit/ec725807126cbccf6f04c54be597e22526ae6e8f
Comment 6 Holger 2021-04-29 19:36:18 UTC
Thanks for working on this - even if it seems to be a small annoyance. I really appreciate your effort to strive to reduce the paper-cuts.

Stay healthy
Comment 7 Nate Graham 2021-04-29 20:10:36 UTC
Git commit 989d9b17c5b8c5588c584dc9cd5440f68315f338 by Nate Graham, on behalf of Alexander Lohnau.
Committed on 29/04/2021 at 20:10.
Pushed by ngraham into branch 'master'.

Set new KRunner property to reduce duplicates and make IDs comparable

M  +22   -1    runners/appstream/appstreamrunner.cpp
M  +2    -2    runners/baloo/baloosearchrunner.cpp
M  +2    -0    runners/baloo/plasma-runner-baloosearch.desktop
M  +1    -0    runners/recentdocuments/plasma-runner-recentdocuments.desktop
M  +1    -0    runners/recentdocuments/recentdocuments.cpp
M  +1    -0    runners/services/plasma-runner-services.desktop
M  +8    -0    runners/services/servicerunner.cpp
M  +2    -0    runners/shell/plasma-runner-shell.desktop
M  +3    -2    runners/shell/shellrunner.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/989d9b17c5b8c5588c584dc9cd5440f68315f338
Comment 8 2wxsy58236r3 2021-04-30 06:06:03 UTC
Can the fix be backported to Frameworks 5.81 & Plasma 5.21?
Comment 9 Nate Graham 2021-04-30 13:24:16 UTC
Not easily, sorry.
Comment 10 Alexander Lohnau 2021-05-19 17:09:03 UTC
Git commit 512135a6502ba551b7349fadf964a83ef6a795e0 by Alexander Lohnau.
Committed on 19/05/2021 at 17:03.
Pushed by alex into branch 'master'.

runners: Prevent duplicate results among bookmarks and locations runner

M  +2    -0    runners/bookmarks/plasma-runner-bookmarks.desktop
M  +4    -0    runners/locations/locationrunner.cpp
M  +2    -0    runners/locations/plasma-runner-locations.desktop

https://invent.kde.org/plasma/plasma-workspace/commit/512135a6502ba551b7349fadf964a83ef6a795e0