Shell search provider doesn't find files outside of home directory
Copied from Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=760366
Steps to reproduce
- In a terminal, run
sudo mkdir /home/spare && sudo chown $USER:$USER /home/spare
- Place a document file (like a pdf or a Word/OpenOffice doc) in /home/spare and ~/Documents.
- Enter Settings->Search.
- Enable "Documents" and "Files" as search providers.
- Click the gear button in the bottom-right corner, and enable "Documents" as a search path in the "Places" tab, and add /home/spare as a search path in the "Other" tab.
- Wait a minute to let Tracker index everything. Run
tracker daemon
to check whether it's finished or not. - In the Overview, search for the file you added to /home/spare and ~/Documents.
Reproducible in:
- Flatpak unstable: yes
- Other: nautilus-3.28.1-1.fc28.x86_64
Current behavior
The file will only appear as a Documents search result, i.e. Documents' search provider does not require files to be under /home/$USER, but Nautilus' does.
Expected behavior
The file will appear in the Overview as a Nautilus search result, and also as a Documents search result.
Additional information
This is not a Tracker bug, as Tracker is able to successfully index files outside of /home/$USER. For example, after following the reproduction steps, tracker info /home/spare/<file>
returns metadata of that file, proving that it was indexed.
A useful comment from the original bug report is #8 from António Fernandes:
Looking at the code in nautlus-shell-search-provider.c, it seems that the user's home is indeed the scope of the search:
home = g_file_new_for_path (g_get_home_dir ());
...
nautilus_query_set_location (query, home);