Dolphin Search Does Not Properly Display Matching Results

When searching for files in folders within dolphin it is very hit or miss for a match when the text clearly contains the characters being searched for. As you can see in the attached screen capture that it doesn’t display the proper results when searching within a folder or folders.

dolphinsearch

I’ve created an issue about this here a while back, but so far it hasn’t been addressed. Hopefully it can be corrected at some point before plasma 6.

System Specs:

Operating System: KDE neon 5.27
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.108.0
Qt Version: 5.15.10
Kernel Version: 6.2.0-26-generic (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 5600G with Radeon Graphics
Memory: 16.0 GiB of RAM
Graphics Processor: AMD Radeon RX 5500

So, supposedly the problem is that in the search directory there are 5 files with the text “frame” somewhere in their filename.

  • When searching for “frame”, only 1 is found
  • When searching for “fram”, only 3 are shown
  • When searching for “f” none are hown.

I believe the search is powered by Baloo, so if the issue is in Baloo and can probably be reproduced on the command line by running baloosearch -d ~/SearchTest "frame".

So this is how it looks on my system, after recreating the SearchTest folder with its 5 files:

$ ls searchtest/
dataframetest.txt  data_frame.txt  dataframe.txt  framedata.txt  _frame.txt
$ baloosearch -d searchtest/ "frame"
Using canonical path '/home/odeda/Documents/test/searchtest' for 'searchtest'
/home/odeda/Documents/test/searchtest/_frame.txt
/home/odeda/Documents/test/searchtest/framedata.txt
/home/odeda/Documents/test/searchtest/data_frame.txt
Elapsed: 1.18328 msecs
$ baloosearch -d searchtest/ "fr"
Using canonical path '/home/odeda/Documents/test/searchtest' for 'searchtest'
kf.baloo.engine: PostingDB::iter "fr" MDB_NOTFOUND: No matching key/data pair found
/home/odeda/Documents/test/searchtest/_frame.txt
/home/odeda/Documents/test/searchtest/framedata.txt
/home/odeda/Documents/test/searchtest/data_frame.txt
Elapsed: 1.11661 msecs

Yes, this is obviously an issue - of user expectations if not of anything else.

I think the main problem is that people think “substring search” while Baloo is doing some sort of “prefix word search”, so it finds “frame” in various files that have that word in a “clearly distinct manner” in their name (for a computer algorithm definition of “clearly distinct”), and it will also find “fram”, “fra” and “fr” - but not “rame” or “ame”, and - maybe surprisingly - not “f”, because that is not enough letters. When you search for “f”, Baloo will find “f.txt” but not “fa.txt” or “fail.txt”, but it will find those last two if you just search for “fa”.

In the example we see Baloo skipping files with the text “dataframe” in them, because Baloo doesn’t understand that “frame” is a distinct word in the combination “dataframe” - which is understandable because Baloo does not have an English vocabulary. It will find all of those files if you search for “data”.

I think the bug linked above and the bugs referred from it are a good place to continue tracking the discussion, and I also think that the current behavior is not a “unintended behavior” (what we often mean when we say “bug”), and not “wrong” - in the sense that it is useful, especially for people who aren’t computer savvy, and solves many problems with locating files with “human names”.

KDE Neon

I have a similar problem and found multiple other threads about Dolphin issues, when searching for files. If I search: *.json in my home folder it returns results. If I search on external drives it returns nothing. If I search on the entire / disk it also returns nothing. It’s not a permission issue. Can’t figure it out… Any ideas?

When you search in a directory which is not indexed, Dolphin uses an internal search, which unfortunately uses a different syntax (regular expression) for search. Try search for just “json”, or “^.*\.json$” to be precise.

1 Like

This behavior is very confusing to the non technical user. I think it should be “fixed” (i.e changed to align better with user expectations).

Yeah, I think everyone agrees that it should be.

Right… so

  • searching *.json on my external HDD connected through USB does nothing and produces zero results
  • searching “json” makes Doplhin display “searching” but still finds nothing
  • searching ^.*.json$ produces multiple results

Never had such problems when I used Gnome or Mate or Cinnamon. Could you be so kind and explain me that last syntax ( ^.*.json$) and why you used each of those characters and what they mean?

“json” should work. I don’t know why it didn’t.

The last one is “*.json” translated to “regular expression”.

lol. so the “target user group” was Jeff All Along.

I’m using the new search on the latest dolphin, baloo is on, purged and re-indexed, I have rg and rg-all installed and dolphin still can’t find what I’m looking for.

The file search (filenamesearch:/) without baloo/indexing uses regular expressions (pcre).
This isn’t discoverable neither user intuitive, we are thinking it and maybe let the user choose how to interpret the input.

Hence ^.*.json$ matches names that ends with .json
^ is the string beginning
. is any character

  • means 0 to any of the previous character
    json matches the charactor sequence “json”
    $ is the end of the string

The regex here is correct it will match any file ending with “json” like testjson no just those ending with “.json” .

.*\.json would be correct here.