Dear friends,
I've added one more feature to the upcoming release, and it's a fairly
big one: a new, custom query parser - i.e. the component that turns
queries like: "subject:hello and not flag:unread" into lists of
messages.
Since the early days (2008!), mu used Xapian's built-in query-parser;
that worked okayish, but there were a number of things that didn't work
so well (at least in 2008), related to unicode-folding,
special-character handling etc. So over the years, mu accumulated quite
a bit of ugly pre-processing to make that somewhat work.
Somewhat. It helped in quite a few cases, but broke others; not in the
least my inner-peace. There are quite a few bugs from frustrated users
that found their queries unexpectedly fail.
So I wrote a custom query parser from scratch as part of my little
"future mu" research; and I have now back-ported it to the current mu.
There's a new `mu-query` man page which goes into a lot more detail, but
let me share a few highlights:
- overall, the language the new query-parser accepts is quite similar to
the Xapian language; in almost all cases, your queries should continue
to work; however we have some new features;
- phrase searches: you can now search multi-word phrases, e.g.:
$ mu find subject:\"hi there\"
apart from the parser, this also required some changes in indexing,
since Xapian now has to remember the positions of words.
- more precise date/time searches ("3m" is now really 3 months,
not 90 days), a few more such small improvements
- regular expression searches; this might be the biggest new feature.
You can search for regular expressions enclosed in //, e.g.
$ mu find subject:"/f.*bar?/"
which should get you messages about foobar, freebase, feedback, ...
And for me the biggest new feature is that we got rid of quite a bit of
old code :-)
Anyhow, the code's available in git. The new version requires a full
re-index (should be done automatically when you run 'mu index' from the
command line). It also requires a C++14-compatible compiler.
What if something doesn't work as expected?
- check the output of `mu find <your-query> --format=xquery`. That
should give you an idea of how your query is interpreted. The shell
does all kind of processing before mu gets your query, so it's
good to check you got all the quoting/escaping correct
- if it's still unexpected, and mu fails to find some message, please
make a github ticket, but include the raw message (removing any
identifying information), so we can reproduce the issue and perhaps
add it to the unit tests.
Kind regards,
Dirk.
--
Dirk-Jan C. Binnema Helsinki, Finland
e:dj...@djcbsoftware.nl w:
www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C