[Tracker] Delete objects from Tracker index



Hi,

I'm looking for a programmatic way to delete objects from the Tracker
index, both in Tracker 0.6 and in 0.7+.

Suppose a file has been removed from a watched filesystem tree while
Tracker was not running. Subsequent queries might match the file and
return it in the result list. In Netatalk we stat() every matched
object, and in case that fails with ENOENT, we would then attempt to
remove the file from the Tracker index.

In Tracker 0.6 tracker_files_delete() seems to do what we want, in 0.7
we found that Tracker was issuing the following SPARQL calls when
logging was set to debug, deleted file was "/Volumes/test/file1":

DELETE {   ?f a rdfs:Resource .   ?ie a rdfs:Resource } WHERE {   ?f
nie:url "file:///Volumes/test/file1" .  ?ie nie:isStoredAs ?f . }
DELETE {   ?f a rdfs:Resource .   ?ie a rdfs:Resource } WHERE {   ?f
nie:url ?u .  FILTER (tracker:uri-is-descendant
("file:///Volumes/test/file1", ?u))  ?ie nie:isStoredAs ?f .}

DELETE {   ?f tracker:available true } WHERE {   ?f nie:url
"file:///Volumes/test/file1" . }
DELETE {   ?f tracker:available true } WHERE {   ?f nie:url ?u .
FILTER (tracker:uri-is-descendant ("file:///Volumes/test/file1", ?u))}

Would that suffice?

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).

Thoughts?

Thanks!
-f


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