Spotlight support

Ralph Böhme rb at sernet.de
Thu Apr 10 11:18:57 MDT 2014


Hi David

On Thu, Apr 10, 2014 at 02:33:52PM +0200, David Disseldorp wrote:
> On Thu, 10 Apr 2014 13:42:48 +0200, Ralph Böhme wrote:
> > Samba acts as a proxy fowarding search queries to Gnome Tracker after
> > mapping Apple's Spotlight query language to SPARQL.
> 
> Oh, I naively thought that Spotlight made use of the Windows Search
> Protocol (MS-WSP) to query the remote indexing service. Skimming through
> the code it looks like a separate named pipe (mdssvc) is used, with
> presumably a different protocol.

You bet!

> How does Apple's protocol differ?

Completely. :)

Not being familiar with MS-WSP I can't comment on that, but Apple's
implementation is something like binary-SML-RPC (Spotlight Markup
Language, just invented the name :).

A search request when unmarshalled from binary to text format looks
like this: <http://pastebin.com/k7Q6sarQ>

The search string is "kMDQueryString" which in above case was:

kMDItemContentTypeTree=="public.jpeg"cd&&InRange(kMDItemLastUsedDate,$time.iso(2014-03-10T23:00:00Z),$time.iso(2014-04-10T22:00:00Z))

I'm using a flex/bison generated parser that translates this into
SPARQL which is then fed to Tracker.

So the nice thing is, it's all text. The bad thing is, ...

> Is it at all documented?

...it's completey undocumented. :)

> > Comments welcome :-)
> 
> I'll take a closer look in the coming days. Just a comment from
> skimming through: please avoid the macros added with
> https://github.com/slowfranklin/samba/commit/49d75640a2c58f8c6b0a00aae6920be9f38c6678
> 
> They're generally frowned upon, as they affect control-flow (by jumping
> a magic label), and also rely on externally defined variables.

they're actually local variables and imo well defined and consistent
error checking is the best thing since sliced break. :) Anyway, I'm
not eager to introduce this idiom and can exchange that for explicit
gotos.

-Ralph

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de,mailto:kontakt@sernet.de


More information about the samba-technical mailing list