Commit Graph

435 Commits

Author SHA1 Message Date
djcb 7a8d43dc5f only use OP_WILDCARD for xapian >= 1.3.3
It's not available for earlier versions.
2018-05-19 22:22:41 +03:00
djcb 6290e4ad9a query-parser: special-case wildcards
We were transforming wild-card searches into regular-expression
searches; while that works, it's also significantly slower.

So, instead, special-case wildcards, and use the Xapian machinery for
wildcard queries.
2018-05-19 11:20:58 +03:00
Marcelo Henrique Cerri 297120dc6c lib: add last_child flag to thread information
With that flag it's possible to reconstruct the entire thread tree
structure in mu4e.
2018-04-23 01:05:54 -03:00
djcb b4cc67d455 parser/tests: allow for DST change
e.g. 21d / 2w are subject to DST; update the tolerance.
2018-03-31 18:44:17 +03:00
djcb 0356af5c98 mu: avoid runtime warning 2018-03-31 13:17:06 +03:00
djcb ebbe3ea023 mu: _XOPEN_SOURCE: fix typo 2018-03-10 13:05:44 +02:00
djcb 6fe67b354d lib/parser: fix month days
In the olden days, we stored dates like e.g. 20180131121234, and do a
lexicographical check. With that, we could use e.g. upper-limits
201802312359 for "all dates in Feb 2018", even if Feb doesn't have 31
days.

However, nowadays we use time_t values, and g_date_time_new_local raises
errors for non-existent days; easiest fix is to massage things a bit; so
let's do that.

Fixes issue #1197.
2018-02-17 18:07:13 +02:00
djcb 15ba4699ab lib/parser: use g_vasprintf, _XOPEN_SOURCE
Attempt to restore building on Cygwin.
2018-02-11 12:02:53 +02:00
djcb 620912c62b mu: support 'raw' query (internally)
Allow for passing 'raw' queries to xapian, without any parsing.
2017-12-03 22:16:32 +02:00
djcb f840d0deaa parser: promote single value to a range for range-fields
Treat e.g. 'date:20170101' as 'date:20170101..20170101', just like
the Xapian parser does.
2017-12-03 12:39:31 +02:00
djcb dbc162ef9b cosmetic 2017-11-05 13:47:30 +02:00
djcb f794cea6e7 parser: small regex optimization 2017-11-04 14:32:41 +02:00
djcb 6a0654c91b parser/utils: enforce 64-bit times on 32-bit platforms
don't assume a 64-bit platform.
2017-11-04 11:30:23 +00:00
djcb ec51f66da2 test-str: fix arglist test 2017-11-04 13:06:43 +02:00
djcb 3cd150f289 parser: handle implicit 'and not' 2017-11-04 12:59:48 +02:00
djcb d18e0a1d84 query: don't be too eager matching field names
only match shortcuts when the field length was 1.
2017-11-02 08:06:48 +02:00
djcb 65863e46cd parser: fix and-not precedence
For now, don't treat "and not" specially; this gets us back into a
somewhat working state. At some point, we probably _do_ want to
special-case and_not though (since Xapian supports it).
2017-10-31 07:18:14 +02:00
djcb ea2ffe23ae mu: fix quoting/unquoting parameters 2017-10-30 22:06:36 +02:00
djcb 363075a6fd doc: tickle
Don't error out when asked for tickle docs.
2017-10-30 21:15:47 +02:00
djcb 4ca6b527b7 mu: use correct conversion for size
This changed with the new parser.
2017-10-30 21:14:20 +02:00
djcb 6053c1ec1f mu: fix clang build
casting error
2017-10-30 08:25:43 +02:00
djcb 57b5fe6156 mu: some optimizations
add fast-path for (common) plain-ascii. fix silly static misuse.

should improve indexing with some single-digit percentage.
2017-10-29 13:34:57 +02:00
djcb 55ffb524db tokenizer: clean unicode-aware 2017-10-28 14:13:09 +03:00
djcb 0e5e8b6bce parser: add more tests 2017-10-28 14:12:50 +03:00
djcb 509500a9d2 server: update query processing
fix quoting issues with mu4e
2017-10-27 18:43:33 +03:00
djcb 6ce7c89488 phrases: only allow for index fields 2017-10-27 18:42:58 +03:00
djcb fe18603843 parser: fix some post-c++14 code
don't require anything post c++14
2017-10-27 18:40:37 +03:00
djcb 160d3ec036 query-parser: cleanup source string
Ensure there's no non-' ' whitespace, and no trailing/leading spaces.
2017-10-27 01:21:57 +03:00
djcb 7cd7d118e2 query-parser: support phrase queries 2017-10-26 21:31:22 +03:00
djcb 17c97d4606 mu: remove some dead code 2017-10-25 23:50:17 +03:00
djcb 2d966ee2ad tests: remove obsolete tests 2017-10-25 23:50:17 +03:00
djcb aa07c4a27c update commands for new query parser 2017-10-25 23:50:17 +03:00
djcb 5e9cafea59 integrate new query parser 2017-10-25 23:50:17 +03:00
djcb b75f9f508b lib: implement new query parser
mu's query parser is the piece of software that turns your queries
into something the Xapian database can understand. So, if you query
"maildir:/inbox and subject:bla" this must be translated into a
Xapian::Query object which will retrieve the sought after messages.

Since mu's beginning, almost a decade ago, this parser was based on
Xapian's default Xapian::QueryParser. It works okay, but wasn't really
designed for the mu use-case, and had a bit of trouble with anything
that's not A..Z (think: spaces, special characters, unicode etc.).

Over the years, mu added quite a bit of pre-processing trickery to
deal with that. Still, there were corner cases and bugs that were
practically unfixable.

The solution to all of this is to have a custom query processor that
replaces Xapian's, and write it from the ground up to deal with the
special characters etc. I wrote one, as part of my "future, post-1.0
mu" reseach project, and I have now backported it to the mu 0.9.19.

From a technical perspective, this is a major cleanup, and allows us
to get rid of much of the fragile preprocessing both for indexing and
querying. From and end-user perspective this (hopefully) means that
many of the little parsing issues are gone, and it opens the way for
some new features.

From an end-user perspective:
- better support for special characters.
- regexp search! yes, you can now search for regular expressions, e.g.
      subject:/h.ll?o/
  will find subjects with hallo, hello, halo,  philosophy, ...

  As you can imagine, this can be a _heavy_ operation on the database,
  and might take quite a bit longer than a normal query; but it can be
  quite useful.
2017-10-24 22:55:35 +03:00
djcb 97cb519788 cosmetic 2017-08-27 17:33:21 +03:00
djcb 6eceb5eee3 mu: include signers in signature report
Include the names/email address of signer in the reports, so we can use
them in mu4e.
2017-08-27 17:32:23 +03:00
djcb 4014e3d210 mu: cosmetics 2017-07-02 10:46:08 +03:00
Sean 'Shaleh' Perry 588d227171 Simplify logic of mu_str_remove_ctrl_in_place. Add tests. 2017-06-24 13:26:10 +02:00
djcb 99423234b8 mu: fix some compiler warnings 2017-06-24 12:20:16 +02:00
djcb 855a8a5c5e mu: properly escape include file-names (forward)
We weren't properly escaping filenames when returning them for
forwarding. Let's do so now.
2017-04-09 11:31:39 +03:00
Dirk-Jan C. Binnema d4b0b1c3b5 Merge pull request #1031 from avar/add-mu_home-env-variable
Add support for specifying --muhome via MU_HOME in the environment
2017-03-05 15:52:30 +02:00
djcb ce88e76569 cosmetics 2017-03-05 15:32:02 +02:00
djcb 11d0515376 mu: allow for negative first param in sexp date spec
The first parameter xx in a (:date xx yy zz) can be negative in some
cases, e.g. to specify pre-1970 dates.
2017-03-05 15:32:02 +02:00
Ævar Arnfjörð Bjarmason 18b8ce249f Add support for specifying --muhome via MU_HOME in the environment
When you have multiple mu home directories, e.g. for the use case
detailed in my "Changing mu4e-{maildir,mu-home} from a context hook"
post to the mailing list it's quite inconvenient to have to hammer out
"mu --muhome=.. find .." every time you want to run some ad-hoc
command.

This allows me to set up a screen session where I do searches in mu
directory A in some screen panes, and searches in directory B in
others.

I initially called this MU_MUHOME but then I noticed that the perl
plugin has MUP_MU_HOME for analogous functionality, so I'm just
following its example.

The code I'm adding in mu-util.c is just a copy/paste & adjustment of
the same sort of already tested functionality in
mu_util_guess_maildir() just a few lines earlier.
2017-02-17 11:28:45 +01:00
Stig Brautaset cdc2fa1bd8 Respect format=flowed and delsp=yes for viewing plain-text messages 2017-01-31 11:28:55 +00:00
djcb 786e7c3d1f mu: add 'tickle' command, for renaming messages
The new command 'tickle' renames message files in place, which can be
useful for 3rd-party tools.
2017-01-14 13:09:17 +02:00
djcb 688507f193 lib: fix a few compiler warnings
WARN_C(XX)FLAGS is really strict.
2017-01-03 00:37:19 +02:00
djcb 72a1da9da8 mu: fix some compiler warnings 2016-12-28 16:32:39 +02:00
Hong Xu 887e75c4ee Child processes should be session leaders.
If not, when the session of mu is killed, these child processes are also
killed. This scenario shows up when using mu4e: a PDF attachment, for
example, is opened by Evince, but as soon as Emacs exits, Evince is also
killed.
2016-12-28 13:51:20 +02:00
djcb 30dab7c312 cfind: uniquify nicks
Ensure uniqueness of nicks by adding a numerical suffix when the root
nicks are not unique (up to 1000).

Fixes issue #987.
2016-12-27 16:21:10 +02:00