Bug 438528

Summary: balooctl could use a remove subcommand to remove duplicate IDs
Product: [Frameworks and Libraries] frameworks-baloo Reporter: skierpage <skierpage>
Component: balooctlAssignee: baloo-bugs-null
Status: CONFIRMED ---    
Severity: normal CC: dschridde+kde, tagwerk19
Priority: NOR    
Version: 5.82.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=438382
https://bugs.kde.org/show_bug.cgi?id=438527
Latest Commit: Version Fixed In:

Description skierpage 2021-06-13 00:29:44 UTC
SUMMARY
It's possible to have multiple entries in Baloo's index for a file path due to the way it generates its internal IDs (see bug 438382). `baloosearch --id some terms` will show these IDs but you can't clear particular IDs.

STEPS TO REPRODUCE
1. Get into a state where Baloo's index has multiple IDs for a file. This happens to me with files I often edit on a mounted NTFS partition which I told Baloo to index.
2. baloosearch for terms in this file, using its --id option
3. Try to remove the errant IDs with balooctl clear

OBSERVED RESULT
E.g.
  % baloosearch --id FuelCellWorks
  500d900000803 /media/Windows/Users/spage/Documents/ECO.txt
  5be2000000803 /media/Windows/Users/spage/Documents/ECO.txt
  8546e00000803 /media/Windows/Users/spage/Documents/ECO.txt
  ...

EXPECTED RESULT

You should be able to clear particular IDs from Baloo's index. It would work like this:
  % balooctl remove 5be2000000803 nosuchid666 8546e00000803 
  Removing ID 5be2000000803 from index.
  ID nosuchid666 not found in index.
  Removing ID 8546e00000803 from index.
  2 IDs removed from Baloo's index.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.21.5
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.2 on Wayland

ADDITIONAL INFORMATION
The logic in balooctl clear may be broken, bug 438527. If that were fixed, then you could repeatedly enter `balooctl clear /path/to/file` and eventually all the IDs would clear, and then you could `touch /path/to/file` and get Baloo to reindex.  However, I think this would first remove the ID that matches the file on-disk, and it seems generally useful to have a remove [IDs] subcommand.

Maybe removeID is a better subcommand name, but then you'd want arbitrary capitalization handling... "Rewrite it in Rust" 😉
Comment 1 tagwerk19 2021-07-13 16:43:16 UTC
Flag as "Sensible Suggestion"...