Wednesday, May 4, 2005

Slogger, Spotlight and boolean logic

Spotlight is great. In a just a few days of use I've already found it
extremely useful. But, there's two things that have further improved
it's value: Slogger and "secret" codes and logic.

Slogger is a firefox plugin (href=>available here) which
lets you log the full content of every web page you visit. With
Spotlight, this means every web page you visit is now indexed. Very
useful for the "I know I just saw this...". Sort of like a better
version of Google Search History without the nagging privacy issues.
Unfortunately, Slogger on OSX has some issues. First, the log
directory selection doesn't work, so you have to manually set it using
about:config. Second, they've got a (common) firefox extension bug
(not Mac specific) which causes pages loaded in the "background" (eg,
background tabs) to not get logged. I fixed this and provided href=>a patch to version 0.3's slogger.js file
which fixes this. They're up to 0.5 now, and my patch won't work
directly on that version, but the basic idea is the same. I've sent
the info over to Ken Schutte, the maintainer.

Secret logic. Spotlight lacks a sophisticated query grammar, or
does it? On the href=>Spotlight
Tips page they list some useful special keywords like "kind:image"
for restricting searches, but some experimentation has turned up a few
others. We know that a space implies "AND", but it is a "least
precedence AND". Using most other punctuation ("+ "and "," both work,
for example) acts as a "high precedence AND". The "|" (pipe)
character is an "OR". Finally, "(-token)" seems to act as an
excluder, which isn't quite a NOT, but close enough. It has to be
immediately after another keyword with no space. The different
precedence ANDs are nice.

So, "xmas|christmas bob|robert" is ((xmas OR christmas) AND (bob OR
robert)) and "jack+jill|hansel+gretel" is ((jack AND jill) OR (hansel
AND gretel)). The exclusion operator doesn't seem to combine with
others except as a final exclusion step, but something like
"foo+bar|baz(-quux)" works as "(((foo AND bar) OR baz) AND NOT quux)".
As noted on the tips page, putting a phrase in double quotes looks for
that phrase, but it doesn't seem the most consistent; that phrase
appearing in text files, for example, will not show up. Finally,
prefixing the whole query with a single quote has some effect, but
what exactly that is isn't obvious: it seems to exclude any image
search results and according to macosxhints, it doesn't search deleted
text in Word files, for example. Hopefully, Apple will provide some
more detailed docs on this, but in the mean time, exclusion in
particular is really useful to have.

No comments:

Post a Comment