Bug 442786

Summary: Search doesn't work in symlinked directories when Baloo is enabled
Product: [Frameworks and Libraries] frameworks-baloo Reporter: Mircea Kitsune <sonichedgehog_hyperblast00>
Component: generalAssignee: baloo-bugs-null
Status: RESOLVED DUPLICATE    
Severity: normal CC: noiredev, sonichedgehog_hyperblast00, tagwerk19
Priority: NOR    
Version: 5.87.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=435383
https://bugs.kde.org/show_bug.cgi?id=447119
https://bugs.kde.org/show_bug.cgi?id=459572
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Example screenshot, directories
Example screenshot, search

Description Mircea Kitsune 2021-09-21 21:28:31 UTC
SUMMARY

When Baloo is active, searching symlinked directories in Dolphin always returns no results. You can only search inside the original directory at its real path, never through a symlink as well.

STEPS TO REPRODUCE

Create a directory ~/foo. Control + Shift + Left-Click drag it to create a symlink as ~/bar. Place any file inside ~/foo.

OBSERVED RESULT

Go inside ~/foo and use Control + F to open the search bar and do a search, this should work normally and give you results. Now go in ~/bar (its symlink) and do the same, you will be told no results could be found.

EXPECTED RESULT

The search system should be aware of symlinks and show search results as if you're looking at the directory through its original path.

SOFTWARE/OS VERSIONS

Operating System: Manjaro Linux
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Kernel Version: 5.14.2-1-MANJARO (64-bit)
Comment 1 Mircea Kitsune 2021-09-21 21:31:12 UTC
Created attachment 141778 [details]
Example screenshot, directories

A screenshot showing an example directory on my machine. /home/username/Pictures is a symlink pointing to /archive/username/Pictures. As can be seen the content of the directories is identical, they are the same just that one is accessed from the original path and the other from the symlink.
Comment 2 Mircea Kitsune 2021-09-21 21:32:21 UTC
Created attachment 141779 [details]
Example screenshot, search

Now we preform a search in each window. In the original directory the results show up. In the symlink window, "no items matching the search" is printed.
Comment 3 tagwerk19 2021-10-30 07:44:42 UTC
Also see this when you've dragged a folder (creating a symlink) from dolphin to the desktop.

The symlink is created in $HOME/Desktop and point to, for example, $HOME/Documents.

In cases where baloo is not indexing the full $HOME (as is the case with Fedora) if you open the desktop symlink (and get $HOME/Desktop/Documents), you are not querying baloo when you search but relying on the simpler filenamesearch

... Confirming
Comment 4 Mircea Kitsune 2021-10-30 15:04:04 UTC
The problem as I'm noticing it is even greater, as there isn't even fallback to the simple search: Search doesn't work at all and returns no results. I'm assuming the system is trying to use Baloo in this case too, but it doesn't understand symlinks accordingly so it ends up returning empty results.
Comment 5 tagwerk19 2021-11-01 18:46:21 UTC
(In reply to Mircea Kitsune from comment #4)
> The problem as I'm noticing it is even greater, as there isn't even fallback
> to the simple search: Search doesn't work at all and returns no results. I'm
> assuming the system is trying to use Baloo in this case too, but it doesn't
> understand symlinks accordingly so it ends up returning empty results.
I think if you are running Dolphin, have opened /home/username/Pictures and searching from there, you will not get any hits:

    Dolphin thinks that baloo has indexed the folder so it queries baloo
    Baloo hasn't indexed Pictures as it is a symlink
    You get no hits

Whereas if you are running Dolphin, have opened  /archive/username/Pictures and searching from there, you will get "something" (*):

    Dolphin thinks that baloo has not indexed the folder so it does "its own" search
    You'll get something depending on Dolphin's "filenamesearch" logic

(The "asterisk" is there to cover the case that you've configured baloo to index /archive/username/Pictures, if you've done that dolphin will query baloo and baloo should return results.)

Some guesswork is natuarally involved.... 8-]
Comment 6 tagwerk19 2021-12-18 09:13:32 UTC
Created a separate bug that summarises Dolphin/Baloo "symlink troubles", Bug 447119

I think the originally reported issue is described in 447119 "Case 1a" (and in the "Wished For Results"). Symlinks do seem to be the cause of a collection of confusing behaviours. 

Will flag this as a duplicate. If you feel that's wrong and I've missed or misunderstood something, reopen this issue and append details.

*** This bug has been marked as a duplicate of bug 447119 ***