Bug 439909

Summary: Searching in current directory doesn't work alt all
Product: [Applications] dolphin Reporter: Piotr Mierzwinski <piotr.mierzwinski>
Component: searchAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: kfm-devel, piotr.mierzwinski, tagwerk19
Priority: NOR    
Version: 21.04.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: file search - options
dolphin - search 1
dolphin - search 2
file-search_settings-2

Description Piotr Mierzwinski 2021-07-15 21:03:06 UTC
Created attachment 140099 [details]
file search - options

SUMMARY
I opened directory "~/Documents" to find file which I recently saved here. I was very surprise when after using Ctrl+F and putting name of this file I saw blank view. I closed it and started search manually, just typing first letters. I found my file in this way. I wonder why I wasn't to do it by "Search" option.
I thought that maybe baloo didn't update its index yet for this directory, so I also tried to do it next day. Unfortunately with the same result.

Notice that "File Search" is turned on (details on the screen shot).  Some time ago I added my home directory, and found it there with status "indexed". I also added several other directories, which  are "Not indexed", because they are mounted by nfs. In this list there is no "~/Documents"

Additionally I tried to find file which is present in my home directory (which has status "Indexed"). Result the same as previously - blank view.

Because of this my conclusion is: searching in dolphin doesn't work.

STEPS TO REPRODUCE
1. Add your  home directory to be indexed to "Search settings"
2. Save any file in ~/Documents, for example "my_document.pdf"
3. open dolphin, and go to "~/Documents" directory
4. press "Ctrl+F" and paste name of your file

OBSERVED RESULT
blank view

EXPECTED RESULT
file which was searched

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: YES
(available in About System)
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.84
Qt Version: 5.15.2 with latest kde patches

ADDITIONAL INFORMATION
Comment 1 Piotr Mierzwinski 2021-07-15 21:03:49 UTC
Created attachment 140100 [details]
dolphin - search 1
Comment 2 Piotr Mierzwinski 2021-07-15 21:04:27 UTC
Created attachment 140101 [details]
dolphin - search 2
Comment 3 Piotr Mierzwinski 2021-07-15 21:16:55 UTC
Ok. I retested it on different account and turned out that searching works.
Only from some unknown reason it doesn't work on my regular account.
Comment 4 tagwerk19 2021-07-15 22:09:19 UTC
(In reply to Piotr Mierzwinski from comment #0)
> Created attachment 140099 [details]
This says
    Status: Not Running, 0% complete

If baloo was stopped it would not notice and index files you've just added. It could be you are seeing Bug 436352, where the indexer is paused but the button still says "Pause Indexer".

You can try a "balooctl status" from the command line to see what it thinks the state of the indexer is or press the "Pause Indexer" button.
Comment 5 Piotr Mierzwinski 2021-07-15 23:40:33 UTC
(In reply to tagwerk19 from comment #4)
> (In reply to Piotr Mierzwinski from comment #0)
> > Created attachment 140099 [details]
> This says
>     Status: Not Running, 0% complete
> 
> If baloo was stopped it would not notice and index files you've just added.
> It could be you are seeing Bug 436352, where the indexer is paused but the
> button still says "Pause Indexer".
> 
> You can try a "balooctl status" from the command line to see what it thinks
> the state of the indexer is or press the "Pause Indexer" button.

Ups. I didn't notice that status was "Not running, 0% complete"
Maybe I met Bug 436352, but in File Search I clicked nothing. I met status like on first screen shot just after I wanted to check file search status.  Notice that when I click into button "Pause Indexer" then happens nothing - no any message changes in "File Search" window. It looks like on screen shot: "file-search_settings-2.png".

Anyway I went to command line and called following commands:
$ balooctl enable
Enabling and starting the File Indexer

.. and after couple seconds this one:
$ balooctl status
Baloo File Indexer is not running
Total files indexed: 50,045
Files waiting for content indexing: 1
Files failed to index: 10
Current size of index is 345.79 MiB

In attachment please find screenshot of search setting with strange message looking like a bug. Seems baloo failed (maybe because of broken links what I have in home directory), and stopped indexing before has found my newly created file. And info in GUI was:
Status: Not running, 99% complete
Currently  indexing !% (I18N_ARGUMENT_MISSING)

After restart of System Settings window, and checking "File Search" I found the same like on first screen shot.
I wanted to know which files failed (cannot be indexed:), so I called:
$ balooctl failed
The following files could not be indexed:









$ balooctl status
[the same like above]

Hmm. As you can see, is missing information I requested by command.

Of course still I cannot find my file.  Notice that ~/Documents is not symlink only regular folder.
Comment 6 Piotr Mierzwinski 2021-07-15 23:41:11 UTC
Created attachment 140104 [details]
file-search_settings-2
Comment 7 tagwerk19 2021-07-16 06:51:51 UTC
(In reply to Piotr Mierzwinski from comment #5)
> Anyway I went to command line and called following commands:
> $ balooctl enable
> Enabling and starting the File Indexer
> 
> .. and after couple seconds this one:
> $ balooctl status
> Baloo File Indexer is not running
> ...
It's possible you need to enable twice... There are times (Bug 435315) that saying it once is not enough.

> In attachment please find screenshot of search setting with strange message
> looking like a bug...
Hmm. I've seen mention of that elsewhere. I'm not sure of what import it has...

> ... Seems baloo failed (maybe because of broken links what I
> have in home directory), and stopped indexing before has found my newly
> created file ...
Broken links? as in symbolic links pointing nowhere? I think baloo makes a deliberate choice not to follow links. It relies on a one-to-one mapping between the full filename and an internal ID (which is built from the device number of the disc/partition and the inode). A symbolic link could make that a many-to-one mapping. 

I'd suggest as a next step, open a couple of windows and run
    balooctl monitor
in one. That should show you what "baloo is doing" in terms of files indexed. In the second try first the
    balooctl enable
and then a
    balooctl check
The latter prompts baloo to scan through the filesystem looking to see if there are any files it has missed.

> $ balooctl failed
> The following files could not be indexed:
> 
> 
> 
> 
> 
> 
> 
> 
> 
> $ balooctl status
Ooo... Just to make sure I've not missed anything. You've not been running (and updating) this system for a long time? There is a bug about a fix to the database sometime back and the need to reindex now it's fixed (Bug 431664). In this case you'd need to do a
    balooctl purge
and have a cup of coffee... (you will be able to see the files listed as they are indexed listed in the monitor)

Did I cover everything?
Comment 8 Piotr Mierzwinski 2021-07-16 20:27:22 UTC
(In reply to tagwerk19 from comment #7)
> (In reply to Piotr Mierzwinski from comment #5)
> > Anyway I went to command line and called following commands:
> > $ balooctl enable
> > Enabling and starting the File Indexer
> > 
> > .. and after couple seconds this one:
> > $ balooctl status
> > Baloo File Indexer is not running
> > ...
> It's possible you need to enable twice... There are times (Bug 435315) that
> saying it once is not enough.

Yes I did it couple time, but without effect.

> > ... Seems baloo failed (maybe because of broken links what I
> > have in home directory), and stopped indexing before has found my newly
> > created file ...
> Broken links? as in symbolic links pointing nowhere? I think baloo makes a
> deliberate choice not to follow links. It relies on a one-to-one mapping
> between the full filename and an internal ID (which is built from the device
> number of the disc/partition and the inode). A symbolic link could make that
> a many-to-one mapping. 

OK. So maybe files without permission to read?
If not then I don't know what is the reason this failed.

> I'd suggest as a next step, open a couple of windows and run
>     balooctl monitor
> in one. That should show you what "baloo is doing" in terms of files
> indexed. In the second try first the
>     balooctl enable
> and then a
>     balooctl check
> The latter prompts baloo to scan through the filesystem looking to see if
> there are any files it has missed.
OK. I started all commands you suggested. Below please find result:

$ balooctl monitor
Waiting for file indexer to start
Press Ctrl+C to stop monitoring
File indexer is running
Starting
Checking for stale index entries
Waiting for file indexer to start
Press Ctrl+C to stop monitoring

> > $ balooctl failed
> > The following files could not be indexed:
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > $ balooctl status
> Ooo... Just to make sure I've not missed anything. You've not been running
> (and updating) this system for a long time? 
Sorry? What do you mean? I update my system every day, and even couple times. I have Linux Arch based distribution (Antergos, migrated to Arch repositories). 
$ pacman -Q baloo
baloo 5.84.0-1

> There is a bug about a fix to the database sometime back and the need to reindex now it's fixed
> (Bug 431664). In this case you'd need to do a
>     balooctl purge
OK. I did it and another to start indexing, so:
$ balooctl enable 

> and have a cup of coffee... (you will be able to see the files listed as
> they are indexed listed in the monitor)
After some time it was finished and in GUI I found:
"Status Idle, 100% complete [Pause Indexer]"

BTW. Is this button saying "pause" is a bug? Because indexing finished.

And of course this time I was able to find my file in Dolphin :).

> Did I cover everything?
Yes.  I think you did.
Big thanks for help. Seems purge was the solution for this issue. But still don't know why indexing stuck and what files cased this.
Comment 9 tagwerk19 2021-07-16 22:07:35 UTC
(In reply to Piotr Mierzwinski from comment #8)
> Sorry? What do you mean? I update my system every day, and even couple
> times. I have Linux Arch based distribution (Antergos, migrated to Arch
> repositories).
Apologies, I wasn't properly clear...

Could it have been that you started using Baloo when it was version 5.68 (or before), created the index then and have upgraded Baloo over the months (years?).

In that case you might have run into Bug 431664 and sorted it by rebuilding the index.

> "Status Idle, 100% complete [Pause Indexer]"
> 
> BTW. Is this button saying "pause" is a bug? Because indexing finished.
Yes. Maybe the "Pause" shouldn't be shown when there no content indexing to be done :-/

> And of course this time I was able to find my file in Dolphin :).
Good so :-)