Mandatory video (might not appear if you’re reading from a planet):

Following the work of Siegfried to integrate Zeitgeist and the Shell, I decided to see if I could make the Shell search use Tracker. Having the example of the Zeitgeist search providers was a huge help, and I managed (with a lot of trial and error) to hack support for Tracker search in the Shell.

The results returned from Tracker are organized into categories, for now “Documents”, “Music” and “Videos”. This can be very easily extended, as each category is mapped to a SPARQL query while the core logic is abstracted in a base class.

I have experienced a few crashes that I haven’t solved yet, looking at the backtrace it seems that gjs is trying to call some javascript that is not here anymore from the libtracker-sparql callback… It is also not super fast on my computer, though the part that is a bit slow is the adding of items to the results grid (the queries themselves are next to instantaneous).

If you want to try this at home:

  1. You need to patch tracker (any 0.10 series should do) with this patch to add some needed GObject introspection annotations. libtracker-sparql is in Vala, so one could hope you’d get the .gir for free, but because it uses nested namespaces, va_list for some functions etc. it gets complicated. Fixing it properly was outside of the scope of a weekend hack. For the lazy, you can also get the (incomplete but good enough for that hack) gir file directly here.
  2. You need to apply Seif’s “add async search providers” patch that you can find here, as well as a patch to fix thumbnailing when you’re not using GtkRecentInfo (which is not the case since the results come from Tracker), and finally the patch to add the Tracker search providers.

If you use the gir from step 1 directly (don’t forget to compile it to a typelib and install it!), no recompilation at all should be needed since everything in step 2 is javascript. You just need to install the patched shell, and enjoy the better search (plus the few crashes I mentioned above 😉 )!

Even more awesome would be to have *both* Zeitgeist and Tracker work together, so that results would be ordered by popularity. I actually have an experimental patch for tracker-needle, the search UI from Tracker, that does just that, but I’m not happy enough with the UI integration to blog about it yet.

Update: If your browser does not support webm, you can see the video hosted on Vimeo

11 Responses to “Weekend hack: Gnome Shell & Tracker integration”

  1. Great weekend-hack Adrien!

  2. Alex Says:

    Great to see this work!

    A question I have is if and how the Zeitgeist search and Tracker search will coexist within the Shell?

    • @Alex: Tracker and Zeigeist are not focused on the same things, Tracker is about providing information about the contents (and user metadata) of your files, while Zeitgeist focuses on the context where you use them. Crossing the two means that you can for example enrich the search results from Tracker using Zeitgeist (for each results, get the files that were used at the same time, or sort search results by popularity…). Actually, there is even a Zeitgeist extension to export events to Tracker (though the ontology is not merged in Tracker yet), so that you can directly query about the content and the context directly in SPARQL… How they will cooperate is an interesting question, and will mostly depend on the crazy ideas people have to use those two technologies 🙂

      • John Stowers Says:

        How does the zeitgeist FTS extension relate to this?

        • @John I haven’t played enough with zeitgeist to know what it does with FTS… Having the input from a Zeitgeist developer would be interesting. I guess because Zeitgeist cannot depend on Tracker, it can’t assume that Tracker will be here to do FTS and therefore has its own implementation. I’d say the main difference would be that FTS concerns only documents attached to events, whereas Tracker indexes all your personal data.
          I should indeed file a bug to get a more thorough review on my patch, and possibly comments on why the code would crash sometimes. I also have to file a bug against Tracker for gobject-introspection support.

        • Seif Lotfy Says:

          The FTS extension we provide is nothing like what Tracker is doing. The fts extension is just an easy way to search through all metadata of the events and subjects and get them back sorted. We use Xapian for that. If you comment one line out in the code it even indexes the content of the documents. But currently its disables by default so we can focus on context and not content.

      • Seif Lotfy Says:

        I think all the tools to deploy both on different projects is doable. Like Adrien said. Its two different fields. Tracker can relate data over the its metadata while Zeitgeist related them over how they are used.

  3. John Stowers Says:

    Also, can you please file a bug about this so I can track your progress?

  4. Karl Relton Says:

    I would love to see things like Gnome-shell use Tracker & Zeitgeist together. I need the search on file contents feature to dig out documents from over a year ago, and then having Zeitgeist’s knowledge of how/when used improving how search results are presented would make things even better.

    • I’ll try to beat my needle/zeitgeist patch into shape, with that one you can search results from Tracker and get them ordered by popularity using Zeitgeist… I guess I could add info like “last time used” too in the results view.

Comments are closed.