How to stop a file or folder from being indexed in GNOME?

Solution 1:

In Ubuntu GNOME 16.04 with GNOME 3.20 there is now such an application called Search and Indexing (or tracker-gui) installed by default (if it is not installed or if you are running a previous version which does not have it pre-installed then it can be installed by running sudo apt-get install tracker-gui) which one can use to highly flexibly change the indexing settings with (I have blacked out some personal information in one of the screenshots):

Indexing tab

Locations tab

Ignored Content tab

Control tab

System

As can be seen from the above screenshots this covers most of the points in the question.

Solution 2:

By default folders with a .trackerignore file are ignored, so it should be enough to do:

touch .trackerignore

in the folder you don't want to be indexed.