https://bugs.kde.org/show_bug.cgi?id=447119
Bug ID: 447119 Summary: Summary: Dolphin/Baloo search with symlinks Product: frameworks-baloo Version: unspecified Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: baloo-bugs-n...@kde.org Reporter: tagwer...@innerjoin.org Target Milestone: --- SUMMARY: A review of Dolphin/Baloo search issues with symlinks (summarising the different issues to allow duplicates to be closed) BASE ISSUE: Baloo, when indexing, does not "follow" symbolic links and index the files and folders referenced. If you have not explicitly included the target folders "to be indexed", then a baloo search will not find the files. Baloo assumes there's a one-to-one mapping between the filename and the index's internal ID and can trip up if this is not the case. This issue manifests itself in several ways - and there are three/four variables in play, two with the indexing: Where you've created the symlink (in a folder indexed by baloo or not?) Where the symlink is pointing (is the real/target folder being indexed by baloo or not?) and then with the way you are searching: If you are searching "From Here" in Dolphin, does Dolphin think that "Here" is indexed by baloo or not? If searching "Your Files" (or "Everywhere") in Dolphin rather than under a particular folder with "From Here". This means rather many test cases but fortunately not so many different real behaviours 8-] Note that Dolphin reads the list of folders indexed by baloo and queries baloo when it thinks baloo knows. If Dolphin thinks that baloo has not indexed the "needed" folders, it will do it's own "there and then" search. (The processes here are baloosearch and filenamesearch) This is a rabbit hole all of it's own, see the summary: https://bugs.kde.org/show_bug.cgi?id=424871#c4 OBSERVED RESULTS: Case 1... Dolphin asks baloo for search results, the folder holding the symlink and the target folder are indexed. As an example, baloo is indexing your home directory and you've created a symlink in ~/Desktop to ~/Documents In this case the command line baloosearch and Dolphin's Ctrl-F search will return hits - and the files will be given with their canonical names (the real/target folders). In the example, the hits will be files under ~/Documents. All is good. ... 1a A watch point is, if you are in Dolphin, follow the symlink to get to ~/Desktop/Documents and search "From Here", you will not get any hits. Baloo has indexed ~/Documents and Dolphin is querying for results under ~/Desktop/Documents. Worse, Dolphin does not help you distinguish between the cases, both show searching "From Here (Documents)". Bug 333678, Bug 434610 (maybe), Bug 435383 and Bug 442786 are instances of this... Bug 442786 shows just how confusing this can be: if baloo is enabled you will not get any hits searching "From Here" whereas if baloo is disabled, Dolphin will do it's own filenamesearch and you *will* get hits. Case 2... Dolphin asks baloo for search results, the folder holding the symlink is being indexed but the target is *not*. As an example, baloo is indexing your home directory, you've created a symlink in your home to a separate disk you've mounted as /media/morespace In this case the target folders are not being indexed. Baloosearch and Dolphin's Ctrl-F search won't return anything This is confusing if you thought baloo followed the links and indexed the target directories and, as said, baloo doesn't do that. ... 2a The solution is to add "/media/morespace" to the list of included folders in System Settings > Search (or by adding it to the folders[$e] line in .config/baloofilerc). When this done, searches will work and give the "Canonical names" as above. However maybe that's not quite what you're expecting (you want the hits to show the symlink and not dereference it to show the target file/folder. This expectation gets complicated if you have more than one symlink...) This solution also means that if you are in your Home Directory and search in Dolphin "From Here", you won't get hits from your "/media/morespace" folders. Alternative is to search "Your Files" ("Everywhere" of old and it's worth remembering that the simple command line "baloosearch searchterms" give you results from "Everywhere") Bug 439438 and Bug 446715 are instances of this... ... 2b Empirically, it also seems possible to tell baloo to index the symlink. That is, to index ~/morespace rather than the target /media/morespace. It seems that querying baloo then gives the hits "as if" in under ~/morespace. However, in Bug 435383, it was said "Don't do that": https://bugs.kde.org/show_bug.cgi?id=435383#c14 Case 3... You've created a symlink in a folder that is not indexed by baloo. If you are in a folder not indexed by baloo, Dolphin will drop back to it's own "there and then" search, as mentioned in: https://bugs.kde.org/show_bug.cgi?id=424871#c4 The challenge is to work out if Dolphin is asking baloo for the search results or not. Dolphin gives you a slight clue, if the search box looks like this: https://bugsfiles.kde.org/attachment.cgi?id=137169 then Dolphin is asking baloo (and you see that you can specify extra search criteria) whereas if it looks like this: https://bugsfiles.kde.org/attachment.cgi?id=137170 then Dolphin will do its own filenamesearch. As an example, by default Fedora does not index your home directory, just the ~/Documents, ~/Music, ~/Pictures, ~/Videos folders. If you've created a symlink on your ~/Desktop pointing to ~/Documents and: You are in ~/Documents and searching "From Here": You'll be querying baloo and it will find the hits under ~/Documents and you'll see them in the Dolphin search You have followed your symlink to ~/Desktop/Documents (which is not indexed) and are searching "From Here": You'll do a recursive Dolphin filenamesearch and see results "under" ~/Desktop/Documents You are in your Home folder (also not indexed) and are searching "From Here": You'll do a recursive filenamesearch though your entire home directory (including following symlinks) and you'll get duplicated results from both ~/Documents and ~/Desktop/Documents This is *difficult*. Bug 436737 is an example of the confusion. WISHED FOR RESULTS: Baloo should follow symlinks and index target folders (at least those mounted in /etc/fstab) Baloo/Dolphin searches should give the same result set, independent of whether the search "is from" the symlink or the target directory. The full filenames returned should probably reflect the "From Here" That is - searching from ~/morespace gives results under morespace, similarly if searching from your home directory. Searching from /media/morespace gives the results under there and similarly searching "Your Files" (or "Everywhere") returns results as per their real filename. There's an implication here that baloo is clever with symlinks, indexes the "real filenames" but can do searches based on the symlink. Dolphin filename searches, whether via baloosearch or falling back to filenamesearch, should give the same results. -- You are receiving this mail because: You are watching all bug changes.