Dolphin is the default KDE file manager. Like most file managers, it provides a search tool:
Unlike most file managers' search tools, however, Dolphin's is pathetically bad! For example, suppose I'm sitting in my Documents folder, wondering if I've got a document about OpenIndiana:
Excellent news: I have. It's been found by the 'Find' tool because I've searched for the term openindia and it's found a document with “OpenIndiana” in its file name.
Great! What's the problem, then? Search seems to work fine!
Well, consider this:
That's me performing a search for any documents whose contents contain the word “pfexec”: the search engine claims there are no results, despite this fact:
That's a Word document (well, a LibreOffice Writer document, but you get the idea!). In fact, it's the same 'OpenIndiana File Server' document previously found by my earlier search. But what do we see in this file: the text pfexec, at about line 4 of the document. So that term is definitely there… but Dolphin's file search tool didn't see it. The 'search contents' tool is not working as it's supposed to, in other words.
So that's the problem I face with my default OpenSuse Leap 15 KDE desktop: a broken search tool in the file manager. Can it be fixed?
Well, we can try. First of all, click Start → Settings → System Settings. Find the Search icon in the Workspace section, and click to open it:
Here, we see that file content has not been set to be indexed. Additionally, my music files (stored in /multimedia) are not set to be indexed, even though searching by the title of a piece is something I want to do often. So, a simple way to fix things would seem to be to click around a bit! First, switch on file indexing; second, remove /multimedia from the list of places to ignore. Accordingly, I end up with this:
Click [Apply] and then close the various settings windows down. If you try doing a search for a file's contents now… it probably still won't work! Which is a bit of a downer… but don't panic!
The reason poking around with the GUI doesn't really fix things is that the KDE/Dolphin GUI front end doesn't seem to make proper alterations to the actual configuration of the baloo search engine, which is what lies behind the 'Find' option in Dolphin. You think you've switched on file-content searching, but it turns out that you haven't really!
If we get down and dirty on the command line, we can see this to be so:
balooctl status Baloo File Indexer is not running Indexed 1671 / 1671 files Current size of index is 5.82 MiB
Baloo certainly thinks it's indexed enough: 1671 out of 1671 files, so the indexer isn't actually running at the moment, since there's nothing new to index. But let's check what it actually thinks should be indexed, shall we?:
By opening the contents of the $HOME/.config/baloofilerc file, we can see that something of my GUI changes got through to this file: the fact that 'exclude folders' is only set to “continualbackup” and “verdi” indicates that the GUI alterations to the exclusions I made earlier have taken effect. But the fact that the file has a setting for “only basic indexing = true” is a bit of a worry, since that means “only index file names, not their contents”, which is the problem we thought we'd fixed in the GUI.
Well, it's easy enough to change the value for that setting to “false”. I'd also change the value of “first run” to “true” -that will help make baloo think it hasn't actually indexed anything so far. Save the file once both alterations have been made.
Still at the command prompt, you now need to make sure baloo isn't currently running, manually delete it's existing (and wholly inadequate!) index file and then get it to restart indexing everything appropriate from scratch:
balooctl stop rm -rf ~/.local/share/baloo balooctl start
Periodically, you can check it's re-indexing progress:
balooctl status Baloo File Indexer is running Indexer state: Initial Indexing Indexed 155 / 1750 files Current size of index is 1.46 MiB
Notice how, immediately, it has spotted that there are 1750 files to index, rather than the previous 1671. Give it a bit more time and this happens:
balooctl status Baloo File Indexer is running Indexer state: Indexing file content Indexed 18951 / 84458 files Current size of index is 125.98 MiB
Wow! Suddenly there are tens of thousands of files to index rather than a mere couple of thousand! It think it just found my music files!
Since that's quite a lot of work to do, be patient and give it a chance to finish its indexing work. When it has, try searching for things again:
Bingo! Baloo finds my file containing the word 'pfexec' after all -this time correctly looking at the entire content of what is, essentially, a Word document. Even more impressively:
That's a search for any documents which include the name 'Schwartz' -and baloo has managed to find it within a PDF file (that's the impressive bit for me: that it can understand the contents of a PDF), since The Honorable Edward J. Schwartz was the Chief Judge of the District Court for Southern California who took Richard Nixon's deposition about the Watergate affair in 1975:
So the short answer to how you can get Dolphin's file search capability working properly is:
The cost of this is that baloo's new search index will be considerably larger than the original, but I think it's probably worth a few hundred megabytes to get file searching working correctly.