KDE search keeps including hidden folders

Dear KDE community, I am experiencing some “irritations” with how KDE handles filesearch.

I have been using KDE for a year now (on two seperate installatinos) and have avoided filesearch whenever possible so far, as it never seemed to work as I felt it should.

What I found so far

  • There is Krunner, which seems to be able to search for anything and be really useful with all its plugins, but it is a kinda hidden feature. It uses ‘file search’

  • There is the Startmenu search which cannot do all same things as Krunner (is it using only hardcoded subset of krunners abilities/plugins, or is it a completely separate search implementation)? Anyway it also appears to use ‘file search’.

  • File search has a settings page, with the index being powered by baloo

  • There is the file search in dolphin with two modes: simple search (envoking other search tools) and File indexing (which is probably file search again/baloo?).

  • There is kfind which uses ??? or and index (but it mentions slocate instead of ballo). Note: when deselecting search hidden files, it still includes files in hidden folders :frowning: , while it does not find anything in directories behind a symbolic link (at least it didnt in my tests) :(.

  • This all makes a very scattered file search UX

A problem I noticed with baloo

Since krunner, the start menu and dolphin all seem to use baloo, I went an let it create an index of the home directory (system settings >> file search). I set it to not include hidden files and directories, because I want to find user files, not be overwhelmed by thousands of temp and config files. The results: I get results from .local, .config, .julia, … WHY?
I also went ahead and disabled baloo, purged the index, and recreated it, but still same problem.

I know these might be kinda random observations / opinions mixed with actual questions, but that is my experience with KDE regarding file search, and I would be happy if anyone has an idea on how to fix the hidden directories bug, or could explain any of the other irritations is noticed.

PS: is there a way to get the full krunner feature-set in the start menu search?

hi, welcome.

yes file searching in linux is a cluster-f… i don’t know how ppl put up with it.

that said, baloo is doing it’s level best to make searches more sane and for the most part it succeeds at that goal.

however, your experience with hidden files is definitely not typical, even tho the rest of it certainly is.

can you share the output of kinfo so we know the important particulars

is there anything weird about how you set up your user?

have you tried creating a new user and does the same behavior happen with that acct?

Tend to agree, at least in the context of Baloo. That has a setting to index hidden files/folders or not and, in my experience, that works.

You do have the Dolphin Ctrl-H, for hiding and showing hidden files. I think the simple search options explore hidden files/folders and leave it to you to show/hide the results.

My guess here is that Dolphin is doing a “simple search” and not looking up Baloo results, particularly as you say you’ve changed the Baloo config, purged and reindexed…

You can try a command line “$ baloosearch6 whatever” and see whether Baloo on its own gives you hits from hidden folders. If Dolphin does and a command line Baloo does not, then Dolphin is probably dropping back to a simple search.

some important system / config info

The setup is not very typical, but also not soo niche. Currently running CachyOS and further modifications regard either the config of specific applications, one custom kwin script, and this whole setup running on btrfs for snapshots, which required e.g. home to be its own subvolume separatly from root and a couple others. One thing file search / baloo is doing right is ignoring the hidden snapshots directories.

So here some more info:

❯ balooctl6 config show hidden 
no
❯ kinfo 
Operating System: CachyOS Linux  
KDE Plasma Version: 6.7.3 
KDE Frameworks Version: 6.28.0 
Qt Version: 6.11.1 
Kernel Version: 7.1.3-2-cachyos (64-bit) 
Graphics Platform: Wayland 
Processors: 16 × AMD Ryzen 7 5800H with Radeon Graphics 
Memory: 16 GiB of RAM (15.0 GiB usable) 
Graphics Processor 1: AMD Radeon Graphics 
Graphics Processor 2: NVIDIA GeForce RTX 3050 Laptop GPU
❯ balooctl6 status 
Baloo File Indexer is running 
Indexer state: Idle 
Total files indexed: 317,079 
Files waiting for content indexing: 0 
Files failed to index: 0 
Current size of index is 10.18 GiB

nope not yet, how could this be a use specific problem?

I am pretty sure this is not the case. Running baloosearch6 shows files in hidden directories. As example searching for the letter a in .config and counting the results should give 0 hits, but instead:

❯ baloosearch6 -d ~/.config a | wc -l 
Elapsed: 8.25731 msecs 
757

somehow, i think this is the crux of your issue… which is why i asked if there was anything weird about your setup.

dunno, but there is an easy way to rule it out.

I created a new useraccount but the file search indexing / baloo didnt seem to work at all over there. KDE file search settings kept telling me that is was not enabled (status bottom left), while also offering me to pause it (top right). In the terminal balooctl and co where not found.
Multiuser setups are something I am not familiar with on linux, so I am not sure what to learn from this in regards to the problem I have with my account.

creating a new user acct is the equivalent of deleting your user configuration files and resorting the all the defaults provide by your distro (think factory reset).

the fact that indexing is not working even on a new user acct and the fact that for some reason the command line options are not available leads me to believe something is borked about the actual linux installation, or this is a very niche disto specific issue.

you might try a catchyOS support forum to see if anyone else has experienced this odd behavior.

The only thing I envy Windows users for is Everything

FSearch and Catfish are never as fast, and they can’t be as Everything uses NTFS metadata, which afaik no Linux file system has an equivalent for…

the first linux distro that figures out file search for the masses will become the go-to desktop for ex-windows users.

that distro should be a plasma distro.

Btrfs might have a solution. Here’s an excerpt from AI:

Yes. In fact, Btrfs is one of the few Linux filesystems that makes an Everything-like indexer much more practical.

The reason Everything on Windows is so fast is that it doesn’t crawl the disk every time. It reads the NTFS Master File Table (MFT) directly and watches the USN Journal for changes. That gives it:

  • Near-instant startup
  • Very low CPU usage
  • Real-time updates

Btrfs doesn’t expose an MFT equivalent, but it stores all filesystem metadata in B-trees.

What you can use

Btrfs stores:

  • File names
  • Directory hierarchy
  • Inode numbers
  • Timestamps
  • Extents
  • Checksums

These are all in metadata trees.

A userspace program can access them using:

  • BTRFS_IOC_TREE_SEARCH ioctl
  • libbtrfsutil
  • Low-level parsing of B-tree nodes (more work)

This lets you enumerate millions of filenames much faster than recursively calling readdir() on every directory.

The challenge

Unlike NTFS’s USN journal, Btrfs does not provide a stable filesystem change journal for userspace.

So after the initial index you still need change notifications.

Typical solution:

  • Initial scan from metadata trees
  • Monitor filesystem with inotify or fanotify
  • Update your database as changes occur

That’s essentially how many Linux indexers work.

Performance

If implemented well:

  • Initial indexing: much faster than directory walking
  • RAM usage: low
  • Searches: as fast as your in-memory index
  • Updates: nearly real-time

For millions of files it could feel very close to Everything.

Downsides

Your program would only work on Btrfs.

OK, that is wierd. Let me try to see if I can get Baloo to do that same…

I have a cachyos system running. Baloo was disabled initially; I had to select indexing “File names and contents” and then enable Baloo from the command line to get it going.

Without “Also index hidden files and folders”:

baloosearch6 -d ~/.config a | wc -l

gave me no hits. If I enabled “hidden files and folders”, Baloo indexed them and the baloosearch6 found them. If I then disabled “hidden files and folders”, Baloo did not forget the information and a baloosearch6 still found them. I had to purge and reindex to rebuild the index without hidden files…