EDITED:
I have a folder that I named NSFW, inside the folder I have both .trackerignore and .nomedia files, yet other files inside that folder still appear in gnome’s global search.
phalkon@aerie:~/NSFW$ gsettings get org.freedesktop.Tracker3.Miner.Files ignored-directories-with-content
['.trackerignore', '.git', '.hg', '.nomedia']
phalkon@aerie:~/NSFW$ gsettings get org.freedesktop.Tracker3.Miner.Files ignored-directories
['po', 'CVS', 'core-dumps', 'lost+found', 'NSFW']
phalkon@aerie:~/NSFW$ ls -a
. .. .nomedia .trackerignore you_wont_find_me.jpg you_wont_find_me.mkv you_wont_find_me.txt
That said, these files seem to only get indexed after being opened. Files outside the NSFW folder get indexed almost right away without me having to open them first. Probably because they have been picked up by the tracker.
But since Nautilus will include files and folders not indexed by tracker, is there any way to prevent Nautilus from including certain files in the gnome’s global search?
Nautilus’ search provider also queries the recently opened files (~/.local/share/recently-used.xbel) so if from within Nautilus you opened the you_wont_find_me files, they are in to the recently opened files list and consequently are in the search results.
My Documents directory and its subdirectories are set to be indexed in the search settings. As a test I created there:
TEST1 directory with .trackerignore and dont_find_me_1 files
TEST2 directory with .trackerignore and dont_find_me_2 files
TEST3 directory with just dont_find_me_3 file
Then I opened the Documents/TEST1/dont_find_me_1 file from Nautilus, closed Text Editor after. Then from overview doing a search for dont_find_me only finds the dont_find_me_1 file (from recently opened files list) and dont_find_me_3 file (from index, as it has no .trackerignore). It does not find the dont_find_me_2 file as that is not indexed and not in the recently opened files.
I suppose this is how it should work: Tracker (now LocalSearch) doesn’t index files in directories with a .trackerignore file and those are not returned by Nautilus’ search provider, but files you opened from Nautilus are returned as they are in the recently opened files list.
Yes, that seems to be it. Once removed from the recently-used.xbel, the files cannot be found via global search anymore.
It’s too bad that recently-used probably doesn’t have anything in terms of filter, where you could tell it to not bookmark certain files/folders.
But now that I understand where the problem is, I suppose I could write a script or something that would periodically remove unwanted bookmarks from recently-used.
Still I’d say it would be a good idea to add some kind of filter to recently-used, where the user could set files/folders that should not get bookmarked.
People might have files on their machines that for whatever reason they don’t want to pop up during global search.
There’s no granularity to it but in Settings > Privacy & Security you can disable File History (the recently used files list), change how long it remembers files, or clear it once.