Re: [Tracker] Delete objects from Tracker index



On 01/03/13 18:04, Frank Lahm wrote:
Hi Ivan,

2013/3/1 Ivan Frade <ivan frade gmail com>:
On Fri, Mar 1, 2013 at 2:45 PM, Frank Lahm <franklahm gmail com> wrote:
I know that this won't fix the index when files were moved or renamed,
not deleted. And it seems there's no way to let Tracker reindex
filesystem _without_ trashing the existing database (ie
tracker-control -rs).

  Restarting the miner should be enough. It should recrawl the file
system and check the information in the DB is up to date. If this is
not happening, it is a bug. Make sure your configuration is fine and
it is watching the directories (not just indexing them).

Well, automatic indexing for files created is taking place, so I'd say
config is fine. But still, these indexed file stick even though I had
removed them a few minutes before when Tracker was not running. Otoh,
in an earlier attempt it worked ok, after removing a file behind
Tracker back, after restarting the file was removed from the index (at
least it didn't show up as result in queries).

[root fedora16 ralph]# yum info tracker | grep Version
Version    : 0.12.10

[root fedora16 ralph]# gsettings get
org.freedesktop.Tracker.Miner.Files index-recursive-directories
['/Volumes/spotlight', '/Volumes/test', '/Volumes/spectest-ea',
'/Volumes/spectest']

[root fedora16 ralph]# ls -l /Volumes/test
insgesamt 0

[root fedora16 ralph]# tracker-sparql -q "SELECT ?url WHERE { ?obj
nie:url ?url FILTER(regex(?url, '^file:///Volumes/test/.*')) }"
Ergebnisse:
   file:///Volumes/test/netatalk-stp4.tar.gz
   file:///Volumes/test/netatalk-stp4.tar.bz2

[root fedora16 ralph]# tracker-control -S
Speichern:
28 Feb 2013, 05:25:37:  ✓     Store                      - Leerlauf

Indizierer:
28 Feb 2013, 05:25:37:  ✓     Flickr                     - Leerlauf
28 Feb 2013, 05:25:37:  ✓     Dateisystem                - Leerlauf
28 Feb 2013, 05:25:37:  ✗     E-Mails                    - Läuft nicht
oder Plugin ist deaktiviert
28 Feb 2013, 05:25:37:  ✓     Anwendungen                - Leerlauf

[root fedora16 ralph]# tracker-control -t all
Found 142 PIDs…
Prozesskennung 10256 für »tracker-miner-flickr« gefunden
   Prozess 10256 wurde beendet
Prozesskennung 10263 für »tracker-store« gefunden
   Prozess 10263 wurde beendet
Prozesskennung 10272 für »tracker-miner-fs« gefunden
   Prozess 10272 wurde beendet
[root fedora16 ralph]# tracker-control -S
Speichern:
28 Feb 2013, 05:25:46:  ✗     Store                      - Nicht verfügbar

Indizierer:
28 Feb 2013, 05:25:46:  ✗     Flickr                     - Läuft nicht
oder Plugin ist deaktiviert
28 Feb 2013, 05:25:46:  ✗     Dateisystem                - Läuft nicht
oder Plugin ist deaktiviert
28 Feb 2013, 05:25:46:  ✗     E-Mails                    - Läuft nicht
oder Plugin ist deaktiviert
28 Feb 2013, 05:25:46:  ✗     Anwendungen                - Läuft nicht
oder Plugin ist deaktiviert

[root fedora16 ralph]# tracker-control -s
Indizierung wird gestartet …
   ✓ Flickr
   ✓ Dateisystem
   ✗ E-Mails (Plugin könnte deaktiviert sein?)
   ✓ Anwendungen
[root fedora16 ralph]# tracker-sparql -q "SELECT ?url WHERE { ?obj
nie:url ?url FILTER(regex(?url, '^file:///Volumes/test/.*')) }"
Ergebnisse:
   file:///Volumes/test/netatalk-stp4.tar.gz
   file:///Volumes/test/netatalk-stp4.tar.bz2

... few minutes later, still there:

[root fedora16 ralph]# tracker-sparql -q "SELECT ?url WHERE { ?obj
nie:url ?url FILTER(regex(?url, '^file:///Volumes/test/.*')) }"
Ergebnisse:
   file:///Volumes/test/netatalk-stp4.tar.gz
   file:///Volumes/test/netatalk-stp4.tar.bz2

So the question still stands, how can I delete objects from the index
programmatically.

Just a quick point I should make here, are you considering the tracker:available property? Because your queries will show files that are indexed but considered "hidden" or "unavailable" when volumes are unmounted.

If you care about files that are available "now" and not just in the database, you should definitely add the condition "?obj tracker:available true" to your query...

There are plenty of examples in the tracker code base ;)

--
Regards,
Martyn

Founder & Director @ Lanedo GmbH.
http://www.linkedin.com/in/martynrussell


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]