[evolution/gnome-3-36] I#821 - Slow message search



commit 6570f2076cf0d0f68d6ae111fad35c6c0cfdbe1a
Author: Milan Crha <mcrha redhat com>
Date:   Fri May 22 12:00:06 2020 +0200

    I#821 - Slow message search
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/821

 src/e-util/e-filter-code.c           |   7 -
 src/e-util/e-filter-rule.c           |   5 +-
 src/libemail-engine/mail-vfolder.c   |   3 +-
 src/mail/e-mail-free-form-exp.c      |  24 +-
 src/mail/filtertypes.xml.in          | 518 ++++++++-------------------------
 src/mail/message-list.c              |  48 +++-
 src/mail/searchtypes.xml.in          | 542 +++++++++--------------------------
 src/mail/vfoldertypes.xml.in         | 540 +++++++++-------------------------
 src/modules/mail/e-mail-shell-view.c | 119 +++++---
 9 files changed, 530 insertions(+), 1276 deletions(-)
---
diff --git a/src/e-util/e-filter-code.c b/src/e-util/e-filter-code.c
index 0df165fd6d..99fdd34a25 100644
--- a/src/e-util/e-filter-code.c
+++ b/src/e-util/e-filter-code.c
@@ -38,19 +38,12 @@ filter_code_build_code (EFilterElement *element,
 {
        GList *l;
        EFilterInput *fi = (EFilterInput *) element;
-       gboolean is_rawcode = fi->type && g_str_equal (fi->type, "rawcode");
-
-       if (!is_rawcode)
-               g_string_append (out, "(match-all ");
 
        l = fi->values;
        while (l) {
                g_string_append (out, (gchar *) l->data);
                l = g_list_next (l);
        }
-
-       if (!is_rawcode)
-               g_string_append (out, ")");
 }
 
 /* and we have no value */
diff --git a/src/e-util/e-filter-rule.c b/src/e-util/e-filter-rule.c
index c54e640d81..2ec1d8dfc1 100644
--- a/src/e-util/e-filter-rule.c
+++ b/src/e-util/e-filter-rule.c
@@ -831,6 +831,9 @@ filter_rule_build_code (EFilterRule *rule,
                break;
        }
 
+       if (rule->threading != E_FILTER_THREAD_NONE)
+               g_string_append (out, "(match-all ");
+
        switch (rule->grouping) {
        case E_FILTER_GROUP_ALL:
                g_string_append (out, " (and\n  ");
@@ -846,7 +849,7 @@ filter_rule_build_code (EFilterRule *rule,
        g_string_append (out, ")\n");
 
        if (rule->threading != E_FILTER_THREAD_NONE)
-               g_string_append (out, ")\n");
+               g_string_append (out, "))\n");
 }
 
 static void
diff --git a/src/libemail-engine/mail-vfolder.c b/src/libemail-engine/mail-vfolder.c
index 2559670365..3ec3a67d91 100644
--- a/src/libemail-engine/mail-vfolder.c
+++ b/src/libemail-engine/mail-vfolder.c
@@ -235,7 +235,8 @@ vfolder_setup (CamelSession *session,
        m = mail_msg_new (&vfolder_setup_info);
        m->session = g_object_ref (session);
        m->folder = g_object_ref (folder);
-       m->query = g_strdup (query);
+       /* Make sure the query is enclosed in "(match-all ...)", to traverse the folders' content */
+       m->query = (!query || g_str_has_prefix (query, "(match-all ") || strstr (query, "(match-threads ")) ? 
g_strdup (query) : g_strconcat ("(match-all ", query, ")", NULL);
        m->sources_uri = sources_uri;
 
        camel_folder_freeze (m->folder);
diff --git a/src/mail/e-mail-free-form-exp.c b/src/mail/e-mail-free-form-exp.c
index 978a266e89..a9771f9ef0 100644
--- a/src/mail/e-mail-free-form-exp.c
+++ b/src/mail/e-mail-free-form-exp.c
@@ -80,7 +80,7 @@ mail_ffe_build_header_sexp (const gchar *word,
        }
 
        for (ii = 0; header_names[ii]; ii++) {
-               g_string_append_printf (sexp, "(match-all (header-%s \"%s\" %s))", compare_type, 
header_names[ii], encoded_word->str);
+               g_string_append_printf (sexp, "(header-%s \"%s\" %s)", compare_type, header_names[ii], 
encoded_word->str);
        }
 
        if (header_names[1])
@@ -192,7 +192,7 @@ mail_ffe_exists (const gchar *word,
        encoded_word = g_string_new ("");
        camel_sexp_encode_string (encoded_word, word);
 
-       sexp = g_strdup_printf ("(match-all (header-exists %s))", encoded_word->str);
+       sexp = g_strdup_printf ("(header-exists %s)", encoded_word->str);
 
        g_string_free (encoded_word, TRUE);
 
@@ -213,7 +213,7 @@ mail_ffe_tag (const gchar *word,
        encoded_word = g_string_new ("");
        camel_sexp_encode_string (encoded_word, word);
 
-       sexp = g_strdup_printf ("(match-all (not (= (user-tag %s) \"\")))", encoded_word->str);
+       sexp = g_strdup_printf ("(not (= (user-tag %s) \"\"))", encoded_word->str);
 
        g_string_free (encoded_word, TRUE);
 
@@ -253,13 +253,13 @@ mail_ffe_flag (const gchar *word,
                        if (g_ascii_strcasecmp (flag, "Attachment") == 0)
                                flag = "Attachments";
 
-                       sexp = g_strdup_printf ("(match-all (system-flag \"%s\"))", flag);
+                       sexp = g_strdup_printf ("(system-flag \"%s\")", flag);
                        break;
                }
        }
 
        if (!sexp)
-               sexp = g_strdup_printf ("(match-all (not (= (user-tag %s) \"\")))", encoded_word->str);
+               sexp = g_strdup_printf ("(not (= (user-tag %s) \"\"))", encoded_word->str);
 
        g_string_free (encoded_word, TRUE);
 
@@ -280,7 +280,7 @@ mail_ffe_label (const gchar *word,
        encoded_word = g_string_new ("");
        camel_sexp_encode_string (encoded_word, word);
 
-       sexp = g_strdup_printf ("(match-all (or ((= (user-tag \"label\") %s) (user-flag (+ \"$Label\" %s)) 
(user-flag  %s)))",
+       sexp = g_strdup_printf ("(or (= (user-tag \"label\") %s) (user-flag (+ \"$Label\" %s)) (user-flag 
%s))",
                encoded_word->str, encoded_word->str, encoded_word->str);
 
        g_string_free (encoded_word, TRUE);
@@ -309,7 +309,7 @@ mail_ffe_size (const gchar *word,
        encoded_word = g_string_new ("");
        camel_sexp_encode_string (encoded_word, word);
 
-       sexp = g_strdup_printf ("(match-all (%s (get-size) (cast-int %s)))", cmp, encoded_word->str);
+       sexp = g_strdup_printf ("(%s (get-size) (cast-int %s))", cmp, encoded_word->str);
 
        g_string_free (encoded_word, TRUE);
 
@@ -337,7 +337,7 @@ mail_ffe_score (const gchar *word,
        encoded_word = g_string_new ("");
        camel_sexp_encode_string (encoded_word, word);
 
-       sexp = g_strdup_printf ("(match-all (%s (cast-int (user-tag \"score\")) (cast-int %s)))", cmp, 
encoded_word->str);
+       sexp = g_strdup_printf ("(%s (cast-int (user-tag \"score\")) (cast-int %s))", cmp, encoded_word->str);
 
        g_string_free (encoded_word, TRUE);
 
@@ -442,14 +442,14 @@ mail_ffe_process_date (const gchar *get_date_fnc,
 
        rel_days = g_ascii_strtoll (word, &endptr, 10);
        if (rel_days != 0 && endptr && !*endptr) {
-               return g_strdup_printf ("(match-all (%s (compare-date (%s) (%s (get-current-date) %" 
G_GINT64_FORMAT ")) 0))", op, get_date_fnc,
+               return g_strdup_printf ("(%s (compare-date (%s) (%s (get-current-date) %" G_GINT64_FORMAT ")) 
0)", op, get_date_fnc,
                        rel_days < 0 ? "+" : "-", (rel_days < 0 ? -1 : 1) * rel_days * 24 * 60 * 60);
        }
 
        if (!mail_ffe_decode_date_time (word, &tv))
-               return g_strdup_printf ("(match-all (%s (compare-date (%s) (get-current-date)) 0))", op, 
get_date_fnc);
+               return g_strdup_printf ("(%s (compare-date (%s) (get-current-date)) 0)", op, get_date_fnc);
 
-       return g_strdup_printf ("(match-all (%s (compare-date (%s) %" G_GINT64_FORMAT ") 0))", op, 
get_date_fnc, (gint64) tv.tv_sec);
+       return g_strdup_printf ("(%s (compare-date (%s) %" G_GINT64_FORMAT ") 0)", op, get_date_fnc, (gint64) 
tv.tv_sec);
 }
 
 static gchar *
@@ -492,7 +492,7 @@ mail_ffe_attachment (const gchar *word,
                is_neg = TRUE;
        }
 
-       return g_strdup_printf ("(match-all %s(system-flag \"Attachments\")%s)", is_neg ? "(not " : "", 
is_neg ? ")" : "");
+       return g_strdup_printf ("%s(system-flag \"Attachments\")%s", is_neg ? "(not " : "", is_neg ? ")" : 
"");
 }
 
 static const EFreeFormExpSymbol mail_ffe_symbols[] = {
diff --git a/src/mail/filtertypes.xml.in b/src/mail/filtertypes.xml.in
index a6360b3aa7..d963bc65af 100644
--- a/src/mail/filtertypes.xml.in
+++ b/src/mail/filtertypes.xml.in
@@ -6,63 +6,43 @@
    <input type="optionlist" name="sender-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-        (match-all (header-contains "From" ${sender}))
-     </code>
+     <code>(header-contains "From" ${sender})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-        (match-all (not (header-contains "From" ${sender})))
-     </code>
+     <code>(not (header-contains "From" ${sender}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-        (match-all (header-matches "From" ${sender}))
-     </code>
+     <code>(header-matches "From" ${sender})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-        (match-all (not (header-matches "From" ${sender})))
-     </code>
+     <code>(not (header-matches "From" ${sender}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (header-starts-with "From" ${sender}))
-     </code>
+     <code>(header-starts-with "From" ${sender})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (header-starts-with "From" ${sender})))
-     </code>
+     <code>(not (header-starts-with "From" ${sender}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (header-ends-with "From" ${sender}))
-     </code>
+     <code>(header-ends-with "From" ${sender})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (header-ends-with "From" ${sender})))
-     </code>
+     <code>(not (header-ends-with "From" ${sender}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-        (match-all (header-soundex "From" ${sender}))
-     </code>
+     <code>(header-soundex "From" ${sender})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-        (match-all (not (header-soundex "From" ${sender})))
-     </code>
+     <code>(not (header-soundex "From" ${sender}))</code>
     </option>
    </input>
    <input type="string" name="sender" allow-empty="false"/>
@@ -73,78 +53,43 @@
    <input type="optionlist" name="recipient-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (or (header-contains "To" ${recipient})
-                      (header-contains "Cc" ${recipient})))
-     </code>
+     <code>(or (header-contains "To" ${recipient}) (header-contains "Cc" ${recipient}))</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (or
-               (header-contains "To" ${recipient})
-              (header-contains "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-contains "To" ${recipient}) (header-contains "Cc" ${recipient})))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (or (header-matches "To" ${recipient})
-                      (header-matches "Cc" ${recipient})))
-     </code>
+     <code>(or (header-matches "To" ${recipient}) (header-matches "Cc" ${recipient}))</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (or
-               (header-matches "To" ${recipient})
-              (header-matches "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-matches "To" ${recipient}) (header-matches "Cc" ${recipient})))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (or (header-starts-with "To" ${recipient})
-                      (header-starts-with "Cc" ${recipient})))
-     </code>
+     <code>(or (header-starts-with "To" ${recipient}) (header-starts-with "Cc" ${recipient}))</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (or
-               (header-starts-with "To" ${recipient})
-              (header-starts-with "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-starts-with "To" ${recipient}) (header-starts-with "Cc" ${recipient})))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (or (header-ends-with "To" ${recipient})
-                      (header-ends-with "Cc" ${recipient})))
-     </code>
+     <code>(or (header-ends-with "To" ${recipient}) (header-ends-with "Cc" ${recipient}))</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (or
-               (header-ends-with "To" ${recipient})
-              (header-ends-with "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-ends-with "To" ${recipient}) (header-ends-with "Cc" ${recipient})))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-       (match-all (or (header-soundex "To" ${recipient})
-                      (header-soundex "Cc" ${recipient})))
-     </code>
+     <code>(or (header-soundex "To" ${recipient}) (header-soundex "Cc" ${recipient}))</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-       (match-all (not (or
-               (header-soundex "To" ${recipient})
-              (header-soundex "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-soundex "To" ${recipient}) (header-soundex "Cc" ${recipient})))</code>
     </option>
    </input>
    <input type="address" name="recipient" allow-empty="false"/>
@@ -155,63 +100,43 @@
    <input type="optionlist" name="recipient-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains "Cc" ${recipient}))
-     </code>
+     <code>(header-contains "Cc" ${recipient})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains "Cc" ${recipient})))
-     </code>
+     <code>(not (header-contains "Cc" ${recipient}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches "Cc" ${recipient}))
-     </code>
+     <code>(header-matches "Cc" ${recipient})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches "Cc" ${recipient})))
-     </code>
+     <code>(not (header-matches "Cc" ${recipient}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (header-starts-with "Cc" ${recipient}))
-     </code>
+     <code>(header-starts-with "Cc" ${recipient})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (header-starts-with "Cc" ${recipient})))
-     </code>
+     <code>(not (header-starts-with "Cc" ${recipient}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (header-ends-with "Cc" ${recipient}))
-     </code>
+     <code>(header-ends-with "Cc" ${recipient})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (header-ends-with "Cc" ${recipient})))
-     </code>
+     <code>(not (header-ends-with "Cc" ${recipient}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-       (match-all (header-soundex "Cc" ${recipient}))
-     </code>
+     <code>(header-soundex "Cc" ${recipient})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-       (match-all (not (header-soundex "Cc" ${recipient})))
-     </code>
+     <code>(not (header-soundex "Cc" ${recipient}))</code>
     </option>
    </input>
    <input type="address" name="recipient" allow-empty="false"/>
@@ -222,63 +147,43 @@
    <input type="optionlist" name="recipient-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains "Bcc" ${recipient}))
-     </code>
+     <code>(header-contains "Bcc" ${recipient})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-contains "Bcc" ${recipient}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches "Bcc" ${recipient}))
-     </code>
+     <code>(header-matches "Bcc" ${recipient})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-matches "Bcc" ${recipient}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (header-starts-with "Bcc" ${recipient}))
-     </code>
+     <code>(header-starts-with "Bcc" ${recipient})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (header-starts-with "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-starts-with "Bcc" ${recipient}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (header-ends-with "Bcc" ${recipient}))
-     </code>
+     <code>(header-ends-with "Bcc" ${recipient})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (header-ends-with "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-ends-with "Bcc" ${recipient}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-       (match-all (header-soundex "Bcc" ${recipient}))
-     </code>
+     <code>(header-soundex "Bcc" ${recipient})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-       (match-all (not (header-soundex "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-soundex "Bcc" ${recipient}))</code>
     </option>
    </input>
    <input type="address" name="recipient" allow-empty="false"/>
@@ -289,88 +194,43 @@
    <input type="optionlist" name="recipient-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (or (header-contains "From" ${recipient})
-                      (header-contains "To" ${recipient})
-                      (header-contains "Cc" ${recipient})))
-     </code>
+     <code>(or (header-contains "From" ${recipient}) (header-contains "To" ${recipient}) (header-contains 
"Cc" ${recipient}))</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (or
-               (header-contains "From" ${recipient})
-              (header-contains "To" ${recipient})
-              (header-contains "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-contains "From" ${recipient}) (header-contains "To" ${recipient}) 
(header-contains "Cc" ${recipient})))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (or (header-matches "From" ${recipient})
-                      (header-matches "To" ${recipient})
-                      (header-matches "Cc" ${recipient})))
-     </code>
+     <code>(or (header-matches "From" ${recipient}) (header-matches "To" ${recipient}) (header-matches "Cc" 
${recipient}))</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (or
-               (header-matches "From" ${recipient})
-               (header-matches "To" ${recipient})
-              (header-matches "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-matches "From" ${recipient}) (header-matches "To" ${recipient}) (header-matches 
"Cc" ${recipient})))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (or (header-starts-with "From" ${recipient})
-                      (header-starts-with "To" ${recipient})
-                      (header-starts-with "Cc" ${recipient})))
-     </code>
+     <code>(or (header-starts-with "From" ${recipient}) (header-starts-with "To" ${recipient}) 
(header-starts-with "Cc" ${recipient}))</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (or
-               (header-starts-with "From" ${recipient})
-               (header-starts-with "To" ${recipient})
-              (header-starts-with "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-starts-with "From" ${recipient}) (header-starts-with "To" ${recipient}) 
(header-starts-with "Cc" ${recipient})))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (or (header-ends-with "From" ${recipient})
-                      (header-ends-with "To" ${recipient})
-                      (header-ends-with "Cc" ${recipient})))
-     </code>
+     <code>(or (header-ends-with "From" ${recipient}) (header-ends-with "To" ${recipient}) (header-ends-with 
"Cc" ${recipient}))</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (or
-               (header-ends-with "From" ${recipient})
-               (header-ends-with "To" ${recipient})
-              (header-ends-with "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-ends-with "From" ${recipient}) (header-ends-with "To" ${recipient}) 
(header-ends-with "Cc" ${recipient})))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-       (match-all (or (header-soundex "From" ${recipient})
-                      (header-soundex "To" ${recipient})
-                      (header-soundex "Cc" ${recipient})))
-     </code>
+     <code>(or (header-soundex "From" ${recipient}) (header-soundex "To" ${recipient}) (header-soundex "Cc" 
${recipient}))</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-       (match-all (not (or
-               (header-soundex "From" ${recipient})
-               (header-soundex "To" ${recipient})
-              (header-soundex "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-soundex "From" ${recipient}) (header-soundex "To" ${recipient}) (header-soundex 
"Cc" ${recipient})))</code>
     </option>
    </input>
    <input type="address" name="recipient" allow-empty="false"/>
@@ -381,75 +241,51 @@
    <input type="optionlist" name="subject-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains "Subject" ${subject}))
-     </code>
+     <code>(header-contains "Subject" ${subject})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains "Subject" ${subject})))
-     </code>
+     <code>(not (header-contains "Subject" ${subject}))</code>
     </option>
     <option value="has-words">
      <_title>has words</_title>
-     <code>
-       (match-all (header-has-words "Subject" ${subject}))
-     </code>
+     <code>(header-has-words "Subject" ${subject})</code>
     </option>
     <option value="not has-words">
      <_title>does not have words</_title>
-     <code>
-       (match-all (not (header-has-words "Subject" ${subject})))
-     </code>
+     <code>(not (header-has-words "Subject" ${subject}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches "Subject" ${subject}))
-     </code>
+     <code>(header-matches "Subject" ${subject})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches "Subject" ${subject})))
-     </code>
+     <code>(not (header-matches "Subject" ${subject}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-       (match-all (header-starts-with "Subject" ${subject}))
-     </code>
+     <code>(header-starts-with "Subject" ${subject})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-       (match-all (not (header-starts-with "Subject" ${subject})))
-     </code>
+     <code>(not (header-starts-with "Subject" ${subject}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-       (match-all (header-ends-with "Subject" ${subject}))
-     </code>
+     <code>(header-ends-with "Subject" ${subject})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-       (match-all (not (header-ends-with "Subject" ${subject})))
-     </code>
+     <code>(not (header-ends-with "Subject" ${subject}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-        (match-all (header-soundex "Subject" ${subject}))
-     </code>
+     <code>(header-soundex "Subject" ${subject})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-        (match-all (not (header-soundex "Subject" ${subject})))
-     </code>
+     <code>(not (header-soundex "Subject" ${subject}))</code>
     </option>
    </input>
    <input type="string" name="subject"/>
@@ -461,87 +297,59 @@
    <input type="optionlist" name="header-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains ${header-field} ${word}))
-     </code>
+     <code>(header-contains ${header-field} ${word})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains ${header-field} ${word})))
-     </code>
+     <code>(not (header-contains ${header-field} ${word}))</code>
     </option>
     <option value="has-words">
      <_title>has words</_title>
-     <code>
-       (match-all (header-has-words ${header-field} ${word}))
-     </code>
+     <code>(header-has-words ${header-field} ${word})</code>
     </option>
     <option value="not has-words">
      <_title>does not have words</_title>
-     <code>
-       (match-all (not (header-has-words ${header-field} ${word})))
-     </code>
+     <code>(not (header-has-words ${header-field} ${word}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches ${header-field} ${word}))
-     </code>
+     <code>(header-matches ${header-field} ${word})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches ${header-field} ${word})))
-     </code>
+     <code>(not (header-matches ${header-field} ${word}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-       (match-all (header-starts-with ${header-field} ${word}))
-     </code>
+     <code>(header-starts-with ${header-field} ${word})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-       (match-all (not (header-starts-with ${header-field} ${word})))
-     </code>
+     <code>(not (header-starts-with ${header-field} ${word}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-       (match-all (header-ends-with ${header-field} ${word}))
-     </code>
+     <code>(header-ends-with ${header-field} ${word})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-       (match-all (not (header-ends-with ${header-field} ${word})))
-     </code>
+     <code>(not (header-ends-with ${header-field} ${word}))</code>
     </option>
     <option value="exists">
      <_title>exists</_title>
-     <code>
-       (match-all (header-exists ${header-field}))
-     </code>
+     <code>(header-exists ${header-field})</code>
     </option>
     <option value="not exists">
      <_title>does not exist</_title>
-     <code>
-       (match-all (not (header-exists ${header-field})))
-     </code>
+     <code>(not (header-exists ${header-field}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-        (match-all (header-soundex ${header-field} ${word}))
-     </code>
+     <code>(header-soundex ${header-field} ${word})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-        (match-all (not (header-soundex ${header-field} ${word})))
-     </code>
+     <code>(not (header-soundex ${header-field} ${word}))</code>
     </option>
    </input>
    <input type="string" name="word"/>
@@ -558,9 +366,7 @@
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (body-contains ${word})))
-     </code>
+     <code>(not (body-contains ${word}))</code>
     </option>
    </input>
    <input type="string" name="word" allow-empty="false"/>
@@ -583,27 +389,19 @@
   <input type="optionlist" name="date-spec-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-       (match-all (= (compare-date (get-sent-date) ${versus}) 0))
-    </code>
+    <code>(= (compare-date (get-sent-date) ${versus}) 0)</code>
    </option>
    <option value="is-not">
     <_title>is not</_title>
-    <code>
-       (match-all (not (= (compare-date (get-sent-date) ${versus}) 0)))
-    </code>
+    <code>(not (= (compare-date (get-sent-date) ${versus}) 0))</code>
    </option>
    <option value="before">
     <_title>is before</_title>
-    <code>
-       (match-all (&lt; (compare-date (get-sent-date) ${versus}) 0))
-    </code>
+    <code>(&lt; (compare-date (get-sent-date) ${versus}) 0)</code>
    </option>
    <option value="after">
     <_title>is after</_title>
-    <code>
-       (match-all (&gt; (compare-date (get-sent-date) ${versus}) 0))
-    </code>
+    <code>(&gt; (compare-date (get-sent-date) ${versus}) 0)</code>
    </option>
   </input>    
   <input type="datespec" name="versus"/>
@@ -614,27 +412,19 @@
   <input type="optionlist" name="date-spec-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-       (match-all (= (compare-date (get-received-date) ${versus}) 0))
-    </code>
+    <code>(= (compare-date (get-received-date) ${versus}) 0)</code>
    </option>
    <option value="is-not">
     <_title>is not</_title>
-    <code>
-       (match-all (not (= (compare-date (get-received-date) ${versus}) 0)))
-    </code>
+    <code>(not (= (compare-date (get-received-date) ${versus}) 0))</code>
    </option>
    <option value="before">
     <_title>is before</_title>
-    <code>
-       (match-all (&lt; (compare-date (get-received-date) ${versus}) 0))
-    </code>
+    <code>(&lt; (compare-date (get-received-date) ${versus}) 0)</code>
    </option>
    <option value="after">
     <_title>is after</_title>
-    <code>
-       (match-all (&gt; (compare-date (get-received-date) ${versus}) 0))
-    </code>
+    <code>(&gt; (compare-date (get-received-date) ${versus}) 0)</code>
    </option>
   </input>    
   <input type="datespec" name="versus"/>
@@ -662,27 +452,19 @@
   <input type="optionlist" name="score-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-       (match-all (= (cast-int (user-tag "score")) ${versus}))
-    </code>
+    <code>(= (cast-int (user-tag "score")) ${versus})</code>
    </option>
    <option value="is-not">
     <_title>is not</_title>
-    <code>
-       (match-all (not (= (cast-int (user-tag "score")) ${versus})))
-    </code>
+    <code>(not (= (cast-int (user-tag "score")) ${versus}))</code>
    </option>
    <option value="greater-than">
     <_title>is greater than</_title>
-    <code>
-       (match-all (&gt; (cast-int (user-tag "score")) ${versus}))
-    </code>
+    <code>(&gt; (cast-int (user-tag "score")) ${versus})</code>
    </option>
    <option value="less-than">
     <_title>is less than</_title>
-    <code>
-       (match-all (&lt; (cast-int (user-tag "score")) ${versus}))
-    </code>
+    <code>(&lt; (cast-int (user-tag "score")) ${versus})</code>
    </option>
   </input>
   <input type="score" name="versus"/>
@@ -693,27 +475,19 @@
   <input type="optionlist" name="size-type">
    <option value="greater-than">
     <_title>is greater than</_title>
-    <code>
-       (match-all (&gt; (get-size) ${versus}))
-    </code>
+    <code>(&gt; (get-size) ${versus})</code>
    </option>
    <option value="greater-than-or-equal">
     <_title>is greater than or equal to</_title>
-    <code>
-       (match-all (or (&gt; (get-size) ${versus}) (= (get-size) ${versus})))
-    </code>
+    <code>(or (&gt; (get-size) ${versus}) (= (get-size) ${versus}))</code>
    </option>
    <option value="less-than-or-equal">
     <_title>is less than or equal to</_title>
-    <code>
-       (match-all (or (&lt; (get-size) ${versus}) (= (get-size) ${versus})))
-    </code>
+    <code>(or (&lt; (get-size) ${versus}) (= (get-size) ${versus}))</code>
    </option>
    <option value="less-than">
     <_title>is less than</_title>
-    <code>
-       (match-all (&lt; (get-size) ${versus}))
-    </code>
+    <code>(&lt; (get-size) ${versus})</code>
    </option>
   </input>
   <input type="integer" name="versus"/>
@@ -724,15 +498,11 @@
   <input type="optionlist" name="match-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-     (match-all (system-flag ${flag}))
-    </code>
+    <code>(system-flag ${flag})</code>
    </option>
    <option value="is not">
     <_title>is not</_title>
-    <code>
-     (match-all (not (system-flag ${flag})))
-    </code>
+    <code>(not (system-flag ${flag}))</code>
    </option>
   </input>
   <input type="optionlist" name="flag">
@@ -759,27 +529,19 @@
   <input type="optionlist" name="match-type">
    <option value="is">
     <_title>is Flagged</_title>
-    <code>
-     (match-all (not (= (user-tag "follow-up") "")))
-    </code>
+    <code>(not (= (user-tag "follow-up") ""))</code>
    </option>
    <option value="is not">
     <_title>is not Flagged</_title>
-    <code>
-     (match-all (= (user-tag "follow-up") ""))
-    </code>
+    <code>(= (user-tag "follow-up") "")</code>
    </option>
    <option value="is completed">
     <_title>is Completed</_title>
-    <code>
-       (match-all (and (not (= (user-tag "follow-up") "")) (not (= (user-tag "completed-on") ""))))
-    </code>
+    <code>(and (not (= (user-tag "follow-up") "")) (not (= (user-tag "completed-on") "")))</code>
    </option>
    <option value="is not completed">
     <_title>is not Completed</_title>
-    <code>
-       (match-all (and (not (= (user-tag "follow-up") "")) (= (user-tag "completed-on") "")))
-    </code>
+    <code>(and (not (= (user-tag "follow-up") "")) (= (user-tag "completed-on") ""))</code>
    </option>
   </input>
  </part>
@@ -789,15 +551,11 @@
   <input type="optionlist" name="match-type">
    <option value="exist">
     <_title>Exist</_title>
-    <code>
-     (match-all (system-flag "Attachments"))
-    </code>
+    <code>(system-flag "Attachments")</code>
    </option>
    <option value="not exist">
     <_title>Do Not Exist</_title>
-    <code>
-     (match-all (not (system-flag "Attachments")))
-    </code>
+    <code>(not (system-flag "Attachments"))</code>
    </option>
   </input>
  </part>
@@ -807,15 +565,11 @@
   <input type="optionlist" name="match-type">
    <option value="exist">
     <_title>Exist</_title>
-    <code>
-     (match-all (user-flag "$has_note"))
-    </code>
+    <code>(user-flag "$has_note")</code>
    </option>
    <option value="not exist">
     <_title>Do Not Exist</_title>
-    <code>
-     (match-all (not (user-flag "$has_note")))
-    </code>
+    <code>(not (user-flag "$has_note"))</code>
    </option>
   </input>
  </part>
@@ -825,19 +579,19 @@
    <input type="optionlist" name="mlist-type">
     <option value="is">
         <_title>is</_title>
-        <code>(match-all (header-matches "x-camel-mlist" ${mlist}))</code>
+        <code>(header-matches "x-camel-mlist" ${mlist})</code>
     </option>
     <option value="is not">
         <_title>is not</_title>
-        <code>(match-all (not (header-matches "x-camel-mlist" ${mlist})))</code>
+        <code>(not (header-matches "x-camel-mlist" ${mlist}))</code>
     </option>
     <option value="contains">
         <_title>contains</_title>
-        <code>(match-all (header-contains "x-camel-mlist" ${mlist}))</code>
+        <code>(header-contains "x-camel-mlist" ${mlist})</code>
     </option>
     <option value="not contains">
         <_title>does not contain</_title>
-        <code>(match-all (not (header-contains "x-camel-mlist" ${mlist})))</code>
+        <code>(not (header-contains "x-camel-mlist" ${mlist}))</code>
     </option>
    </input>
    <input type="string" name="mlist" allow-empty="false"/>
@@ -848,15 +602,11 @@
   <input type="optionlist" name="match-type">
    <option value="header">
     <_title>Message Header</_title>
-    <code>
-       (match-all (header-full-regex ${expression}))
-    </code>
+    <code>(header-full-regex ${expression})</code>
    </option>
    <option value="body">
     <_title>Message Body</_title>
-    <code>
-       (match-all (body-regex ${expression}))
-    </code>
+    <code>(body-regex ${expression})</code>
    </option>
   </input>
   <input type="regex" name="expression"/>
@@ -867,15 +617,11 @@
   <input type="optionlist" name="srcmatch-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-      (match-all (header-source ${source}))
-    </code>
+    <code>(header-source ${source})</code>
    </option>
    <option value="is-not">
     <_title>is not</_title>
-    <code>
-      (match-all (not (header-source ${source})))
-    </code>
+    <code>(not (header-source ${source}))</code>
    </option>
   </input>
   <input type="source" name="source"/>
@@ -887,27 +633,19 @@
   <input type="optionlist" name="retval-type">
    <option value="is">
     <_title>returns</_title>
-    <code>
-      (match-all (= (pipe-message "/bin/sh" "-c" ${command}) ${retval}))
-    </code>
+    <code>(= (pipe-message "/bin/sh" "-c" ${command}) ${retval})</code>
    </option>
    <option value="is-not">
     <_title>does not return</_title>
-    <code>
-      (match-all (not (= (pipe-message "/bin/sh" "-c" ${command}) ${retval})))
-    </code>
+    <code>(not (= (pipe-message "/bin/sh" "-c" ${command}) ${retval}))</code>
    </option>
    <option value="greater-than">
     <_title>returns greater than</_title>
-    <code>
-      (match-all (&gt; (pipe-message "/bin/sh" "-c" ${command}) ${retval}))
-    </code>
+    <code>(&gt; (pipe-message "/bin/sh" "-c" ${command}) ${retval})</code>
    </option>
    <option value="less-than">
     <_title>returns less than</_title>
-    <code>
-      (match-all (&lt; (pipe-message "/bin/sh" "-c" ${command}) ${retval}))
-    </code>
+    <code>(&lt; (pipe-message "/bin/sh" "-c" ${command}) ${retval})</code>
    </option>
   </input>
   <input type="integer" name="retval"/>
@@ -918,15 +656,11 @@
   <input type="optionlist" name="retval-type">
    <option value="is-junk">
     <_title>Message is Junk</_title>
-    <code>
-      (match-all (junk-test))
-    </code>
+    <code>(junk-test)</code>
    </option>
    <option value="is-not-junk">
     <_title>Message is not Junk</_title>
-    <code>
-      (match-all (not (junk-test)))
-    </code>
+    <code>(not (junk-test))</code>
    </option>
   </input>
  </part>
@@ -935,26 +669,20 @@
   <input type="optionlist" name="msglocation-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-      (match-all (message-location ${folder}))
-    </code>
+    <code>(message-location ${folder})</code>
    </option>
    <option value="is-not">
     <_title>is not</_title>
-    <code>
-      (match-all (not (message-location ${folder})))
-    </code>
+    <code>(not (message-location ${folder}))</code>
    </option>
   </input>
   <input type="folder" name="folder"/>
  </part>
 
-    <part name="all">
-      <_title>Match All</_title>
-      <code>
-       (match-all #t)
-      </code>
-    </part>
+ <part name="all">
+  <_title>Match All</_title>
+  <code>#t</code>
+ </part>
 
 </partset>
 
diff --git a/src/mail/message-list.c b/src/mail/message-list.c
index 8f385f4a3a..01b7528850 100644
--- a/src/mail/message-list.c
+++ b/src/mail/message-list.c
@@ -6164,28 +6164,56 @@ message_list_regen_thread (GSimpleAsyncResult *simple,
 
        if (hide_deleted && hide_junk) {
                g_string_append_printf (
-                       expr, "(match-all (and %s %s))",
+                       expr, "(and %s %s)",
                        EXCLUDE_DELETED_MESSAGES_EXPR,
                        EXCLUDE_JUNK_MESSAGES_EXPR);
        } else if (hide_deleted) {
-               g_string_append_printf (
-                       expr, "(match-all %s)",
-                       EXCLUDE_DELETED_MESSAGES_EXPR);
+               g_string_append (expr, EXCLUDE_DELETED_MESSAGES_EXPR);
        } else if (hide_junk) {
-               g_string_append_printf (
-                       expr, "(match-all %s)",
-                       EXCLUDE_JUNK_MESSAGES_EXPR);
+               g_string_append (expr, EXCLUDE_JUNK_MESSAGES_EXPR);
        }
 
+       /* The 'expr' should be enclosed in "(match-all ...)", thus the search traverses
+          folder content, but also try to not repeat it, to avoid unnecessary performance hits. */
        if (regen_data->search != NULL) {
+               gboolean is_match_all = g_str_has_prefix (regen_data->search, "(match-all ");
+               gboolean is_match_threads = strstr (regen_data->search, "(match-threads ") != NULL;
+
                if (expr->len == 0) {
                        g_string_assign (expr, regen_data->search);
-               } else {
-                       g_string_prepend (expr, "(and ");
-                       g_string_append_c (expr, ' ');
+
+                       if (!is_match_all && !is_match_threads && expr->len) {
+                               g_string_prepend (expr, "(match-all ");
+                               g_string_append_c (expr, ')');
+                       }
+               } else if (is_match_threads) {
+                       /* The "match-threads" cannot be below "match-all". */
+                       g_string_prepend (expr, "(and (match-all ");
+                       g_string_append (expr, ") ");
                        g_string_append (expr, regen_data->search);
                        g_string_append_c (expr, ')');
+               } else {
+                       g_string_prepend (expr, "(match-all (and ");
+                       g_string_append_c (expr, ' ');
+
+                       if (is_match_all) {
+                               const gchar *stripped_search = regen_data->search + 11; /* strlen 
("(match-all ") */
+                               gint len = strlen (stripped_search);
+
+                               if (len > 0 && stripped_search[len - 1] == ')') {
+                                       g_string_append_len (expr, stripped_search, len - 1);
+                               } else {
+                                       g_string_append (expr, regen_data->search);
+                               }
+                       } else {
+                               g_string_append (expr, regen_data->search);
+                       }
+
+                       g_string_append (expr, "))");
                }
+       } else if (expr->len) {
+               g_string_prepend (expr, "(match-all ");
+               g_string_append_c (expr, ')');
        }
 
        /* Execute the search. */
diff --git a/src/mail/searchtypes.xml.in b/src/mail/searchtypes.xml.in
index fbdb0d6121..e03e28e60f 100644
--- a/src/mail/searchtypes.xml.in
+++ b/src/mail/searchtypes.xml.in
@@ -2,47 +2,39 @@
 <filterdescription>
 <partset>
  <part name="sender">
-  <_title>Sender</_title>
+   <_title>Sender</_title>
    <input type="optionlist" name="sender-type">
     <option value="contains">
-        <_title>contains</_title>
-       <code>(match-all (header-contains "From" ${sender}))</code>
+     <_title>contains</_title>
+     <code>(header-contains "From" ${sender})</code>
     </option>
     <option value="not contains">
-        <_title>does not contain</_title>
-        <code>(match-all (not (header-contains "From" ${sender})))</code>
+     <_title>does not contain</_title>
+     <code>(not (header-contains "From" ${sender}))</code>
     </option>
     <option value="is">
-        <_title>is</_title>
-       <code>(match-all (header-matches "From" ${sender}))</code>
+     <_title>is</_title>
+     <code>(header-matches "From" ${sender})</code>
     </option>
     <option value="is not">
-        <_title>is not</_title>
-        <code>(match-all (not (header-matches "From" ${sender})))</code>
+     <_title>is not</_title>
+     <code>(not (header-matches "From" ${sender}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (header-starts-with "From" ${sender}))
-     </code>
+     <code>(header-starts-with "From" ${sender})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (header-starts-with "From" ${sender})))
-     </code>
+     <code>(not (header-starts-with "From" ${sender}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (header-ends-with "From" ${sender}))
-     </code>
+     <code>(header-ends-with "From" ${sender})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (header-ends-with "From" ${sender})))
-     </code>
+     <code>(not (header-ends-with "From" ${sender}))</code>
     </option>
    </input>
    <input type="string" name="sender"/>
@@ -57,63 +49,35 @@
    <input type="optionlist" name="recipient-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (or (header-contains "To" ${recipient})
-                      (header-contains "Cc" ${recipient})))
-     </code>
+     <code>(or (header-contains "To" ${recipient}) (header-contains "Cc" ${recipient}))</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (or
-                          (header-contains "To" ${recipient})
-                         (header-contains "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-contains "To" ${recipient}) (header-contains "Cc" ${recipient})))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (or (header-matches "To" ${recipient})
-                         (header-matches "Cc" ${recipient})))
-     </code>
+     <code>(or (header-matches "To" ${recipient}) (header-matches "Cc" ${recipient}))</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (or
-               (header-matches "To" ${recipient})
-              (header-matches "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-matches "To" ${recipient}) (header-matches "Cc" ${recipient})))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (or (header-starts-with "To" ${recipient})
-                         (header-starts-with "Cc" ${recipient})))
-     </code>
+     <code>(or (header-starts-with "To" ${recipient}) (header-starts-with "Cc" ${recipient}))</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (or
-               (header-starts-with "To" ${recipient})
-              (header-starts-with "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-starts-with "To" ${recipient}) (header-starts-with "Cc" ${recipient})))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (or (header-ends-with "To" ${recipient})
-                         (header-ends-with "Cc" ${recipient})))
-     </code>
+     <code>(or (header-ends-with "To" ${recipient}) (header-ends-with "Cc" ${recipient}))</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (or
-               (header-ends-with "To" ${recipient})
-              (header-ends-with "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-ends-with "To" ${recipient}) (header-ends-with "Cc" ${recipient})))</code>
     </option>
    </input>
    <input type="address" name="recipient"/>
@@ -124,63 +88,43 @@
    <input type="optionlist" name="recipient-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains "To" ${recipient}))
-     </code>
+     <code>(header-contains "To" ${recipient})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains "To" ${recipient})))
-     </code>
+     <code>(not (header-contains "To" ${recipient}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches "To" ${recipient}))
-     </code>
+     <code>(header-matches "To" ${recipient})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches "To" ${recipient})))
-     </code>
+     <code>(not (header-matches "To" ${recipient}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (header-starts-with "To" ${recipient}))
-     </code>
+     <code>(header-starts-with "To" ${recipient})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (header-starts-with "To" ${recipient})))
-     </code>
+     <code>(not (header-starts-with "To" ${recipient}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (header-ends-with "To" ${recipient}))
-     </code>
+     <code>(header-ends-with "To" ${recipient})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (header-ends-with "To" ${recipient})))
-     </code>
+     <code>(not (header-ends-with "To" ${recipient}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-       (match-all (header-soundex "To" ${recipient}))
-     </code>
+     <code>(header-soundex "To" ${recipient})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-       (match-all (not (header-soundex "To" ${recipient})))
-     </code>
+     <code>(not (header-soundex "To" ${recipient}))</code>
     </option>
    </input>
    <input type="address" name="recipient"/>
@@ -191,63 +135,43 @@
    <input type="optionlist" name="recipient-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains "Cc" ${recipient}))
-     </code>
+     <code>(header-contains "Cc" ${recipient})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains "Cc" ${recipient})))
-     </code>
+     <code>(not (header-contains "Cc" ${recipient}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches "Cc" ${recipient}))
-     </code>
+     <code>(header-matches "Cc" ${recipient})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches "Cc" ${recipient})))
-     </code>
+     <code>(not (header-matches "Cc" ${recipient}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (header-starts-with "Cc" ${recipient}))
-     </code>
+     <code>(header-starts-with "Cc" ${recipient})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (header-starts-with "Cc" ${recipient})))
-     </code>
+     <code>(not (header-starts-with "Cc" ${recipient}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (header-ends-with "Cc" ${recipient}))
-     </code>
+     <code>(header-ends-with "Cc" ${recipient})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (header-ends-with "Cc" ${recipient})))
-     </code>
+     <code>(not (header-ends-with "Cc" ${recipient}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-       (match-all (header-soundex "Cc" ${recipient}))
-     </code>
+     <code>(header-soundex "Cc" ${recipient})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-       (match-all (not (header-soundex "Cc" ${recipient})))
-     </code>
+     <code>(not (header-soundex "Cc" ${recipient}))</code>
     </option>
    </input>
    <input type="address" name="recipient"/>
@@ -258,63 +182,43 @@
    <input type="optionlist" name="recipient-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains "Bcc" ${recipient}))
-     </code>
+     <code>(header-contains "Bcc" ${recipient})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-contains "Bcc" ${recipient}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches "Bcc" ${recipient}))
-     </code>
+     <code>(header-matches "Bcc" ${recipient})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-matches "Bcc" ${recipient}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (header-starts-with "Bcc" ${recipient}))
-     </code>
+     <code>(header-starts-with "Bcc" ${recipient})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (header-starts-with "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-starts-with "Bcc" ${recipient}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (header-ends-with "Bcc" ${recipient}))
-     </code>
+     <code>(header-ends-with "Bcc" ${recipient})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (header-ends-with "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-ends-with "Bcc" ${recipient}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-       (match-all (header-soundex "Bcc" ${recipient}))
-     </code>
+     <code>(header-soundex "Bcc" ${recipient})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-       (match-all (not (header-soundex "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-soundex "Bcc" ${recipient}))</code>
     </option>
    </input>
    <input type="address" name="recipient"/>
@@ -325,71 +229,35 @@
    <input type="optionlist" name="recipient-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (or (header-contains "From" ${recipient})
-                      (header-contains "To" ${recipient})
-                      (header-contains "Cc" ${recipient})))
-     </code>
+     <code>(or (header-contains "From" ${recipient}) (header-contains "To" ${recipient}) (header-contains 
"Cc" ${recipient}))</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (or
-                          (header-contains "From" ${recipient})
-                          (header-contains "To" ${recipient})
-                          (header-contains "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-contains "From" ${recipient}) (header-contains "To" ${recipient}) 
(header-contains "Cc" ${recipient})))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (or (header-matches "From" ${recipient})
-                         (header-matches "To" ${recipient})
-                         (header-matches "Cc" ${recipient})))
-     </code>
+     <code>(or (header-matches "From" ${recipient}) (header-matches "To" ${recipient}) (header-matches "Cc" 
${recipient}))</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (or
-               (header-matches "From" ${recipient})
-               (header-matches "To" ${recipient})
-               (header-matches "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-matches "From" ${recipient}) (header-matches "To" ${recipient}) (header-matches 
"Cc" ${recipient})))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (or (header-starts-with "From" ${recipient})
-                         (header-starts-with "To" ${recipient})
-                         (header-starts-with "Cc" ${recipient})))
-     </code>
+     <code>(or (header-starts-with "From" ${recipient}) (header-starts-with "To" ${recipient}) 
(header-starts-with "Cc" ${recipient}))</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (or
-               (header-starts-with "From" ${recipient})
-               (header-starts-with "To" ${recipient})
-               (header-starts-with "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-starts-with "From" ${recipient}) (header-starts-with "To" ${recipient}) 
(header-starts-with "Cc" ${recipient})))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (or (header-ends-with "From" ${recipient})
-                         (header-ends-with "To" ${recipient})
-                         (header-ends-with "Cc" ${recipient})))
-     </code>
+     <code>(or (header-ends-with "From" ${recipient}) (header-ends-with "To" ${recipient}) (header-ends-with 
"Cc" ${recipient}))</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (or
-               (header-ends-with "From" ${recipient})
-               (header-ends-with "To" ${recipient})
-               (header-ends-with "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-ends-with "From" ${recipient}) (header-ends-with "To" ${recipient}) 
(header-ends-with "Cc" ${recipient})))</code>
     </option>
    </input>
    <input type="string" name="recipient"/>
@@ -400,63 +268,43 @@
    <input type="optionlist" name="subject-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains "Subject" ${subject}))
-     </code>
+     <code>(header-contains "Subject" ${subject})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains "Subject" ${subject})))
-     </code>
+     <code>(not (header-contains "Subject" ${subject}))</code>
     </option>
     <option value="has-words">
      <_title>has words</_title>
-     <code>
-       (match-all (header-has-words "Subject" ${subject}))
-     </code>
+     <code>(header-has-words "Subject" ${subject})</code>
     </option>
     <option value="not has-words">
      <_title>does not have words</_title>
-     <code>
-       (match-all (not (header-has-words "Subject" ${subject})))
-     </code>
+     <code>(not (header-has-words "Subject" ${subject}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches "Subject" ${subject}))
-     </code>
+     <code>(header-matches "Subject" ${subject})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches "Subject" ${subject})))
-     </code>
+     <code>(not (header-matches "Subject" ${subject}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-       (match-all (header-starts-with "Subject" ${subject}))
-     </code>
+     <code>(header-starts-with "Subject" ${subject})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-       (match-all (not (header-starts-with "Subject" ${subject})))
-     </code>
+     <code>(not (header-starts-with "Subject" ${subject}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-       (match-all (header-ends-with "Subject" ${subject}))
-     </code>
+     <code>(header-ends-with "Subject" ${subject})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-       (match-all (not (header-ends-with "Subject" ${subject})))
-     </code>
+     <code>(not (header-ends-with "Subject" ${subject}))</code>
     </option>
    </input>
    <input type="string" name="subject"/>
@@ -468,87 +316,59 @@
    <input type="optionlist" name="header-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains ${header-field} ${word}))
-     </code>
+     <code>(header-contains ${header-field} ${word})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains ${header-field} ${word})))
-     </code>
+     <code>(not (header-contains ${header-field} ${word}))</code>
     </option>
     <option value="has-words">
      <_title>has words</_title>
-     <code>
-       (match-all (header-has-words ${header-field} ${word}))
-     </code>
+     <code>(header-has-words ${header-field} ${word})</code>
     </option>
     <option value="not has-words">
      <_title>does not have words</_title>
-     <code>
-       (match-all (not (header-has-words ${header-field} ${word})))
-     </code>
+     <code>(not (header-has-words ${header-field} ${word}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches ${header-field} ${word}))
-     </code>
+     <code>(header-matches ${header-field} ${word})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches ${header-field} ${word})))
-     </code>
+     <code>(not (header-matches ${header-field} ${word}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-       (match-all (header-starts-with ${header-field} ${word}))
-     </code>
+     <code>(header-starts-with ${header-field} ${word})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-       (match-all (not (header-starts-with ${header-field} ${word})))
-     </code>
+     <code>(not (header-starts-with ${header-field} ${word}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-       (match-all (header-ends-with ${header-field} ${word}))
-     </code>
+     <code>(header-ends-with ${header-field} ${word})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-       (match-all (not (header-ends-with ${header-field} ${word})))
-     </code>
+     <code>(not (header-ends-with ${header-field} ${word}))</code>
     </option>
     <option value="exists">
      <_title>exists</_title>
-     <code>
-       (match-all (header-exists ${header-field}))
-     </code>
+     <code>(header-exists ${header-field})</code>
     </option>
     <option value="not exists">
      <_title>does not exist</_title>
-     <code>
-       (match-all (not (header-exists ${header-field})))
-     </code>
+     <code>(not (header-exists ${header-field}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-        (match-all (header-soundex ${header-field} ${word}))
-     </code>
+     <code>(header-soundex ${header-field} ${word})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-        (match-all (not (header-soundex ${header-field} ${word})))
-     </code>
+     <code>(not (header-soundex ${header-field} ${word}))</code>
     </option>
    </input>
    <input type="string" name="word"/>
@@ -559,75 +379,51 @@
    <input type="optionlist" name="header-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains "" ${word}))
-     </code>
+     <code>(header-contains "" ${word})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains "" ${word})))
-     </code>
+     <code>(not (header-contains "" ${word}))</code>
     </option>
     <option value="has-words">
      <_title>has words</_title>
-     <code>
-       (match-all (header-has-words "" ${word}))
-     </code>
+     <code>(header-has-words "" ${word})</code>
     </option>
     <option value="not has-words">
      <_title>does not have words</_title>
-     <code>
-       (match-all (not (header-has-words "" ${word})))
-     </code>
+     <code>(not (header-has-words "" ${word}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches "" ${word}))
-     </code>
+     <code>(header-matches "" ${word})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches "" ${word})))
-     </code>
+     <code>(not (header-matches "" ${word}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-       (match-all (header-starts-with "" ${word}))
-     </code>
+     <code>(header-starts-with "" ${word})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-       (match-all (not (header-starts-with "" ${word})))
-     </code>
+     <code>(not (header-starts-with "" ${word}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-       (match-all (header-ends-with "" ${word}))
-     </code>
+     <code>(header-ends-with "" ${word})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-       (match-all (not (header-ends-with "" ${word})))
-     </code>
+     <code>(not (header-ends-with "" ${word}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-        (match-all (header-soundex "" ${word}))
-     </code>
+     <code>(header-soundex "" ${word})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-        (match-all (not (header-soundex "" ${word})))
-     </code>
+     <code>(not (header-soundex "" ${word}))</code>
     </option>
    </input>
    <input type="string" name="word"/>
@@ -638,15 +434,11 @@
    <input type="optionlist" name="body-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (body-contains ${word})
-     </code>
+     <code>(body-contains ${word})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (not (body-contains ${word}))
-     </code>
+     <code>(not (body-contains ${word}))</code>
     </option>
    </input>
    <input type="string" name="word"/>
@@ -668,27 +460,19 @@
   <input type="optionlist" name="date-spec-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-       (match-all (= (compare-date (get-sent-date) ${versus}) 0))
-    </code>
+    <code>(= (compare-date (get-sent-date) ${versus}) 0)</code>
    </option>
    <option value="is-not">
     <_title>is not</_title>
-    <code>
-       (match-all (not (= (compare-date (get-sent-date) ${versus}) 0)))
-    </code>
+    <code>(not (= (compare-date (get-sent-date) ${versus}) 0))</code>
    </option>
    <option value="before">
     <_title>is before</_title>
-    <code>
-       (match-all (&lt; (compare-date (get-sent-date) ${versus}) 0))
-    </code>
+    <code>(&lt; (compare-date (get-sent-date) ${versus}) 0)</code>
    </option>
    <option value="after">
     <_title>is after</_title>
-    <code>
-       (match-all (&gt; (compare-date (get-sent-date) ${versus}) 0))
-    </code>
+    <code>(&gt; (compare-date (get-sent-date) ${versus}) 0)</code>
    </option>
   </input>    
   <input type="datespec" name="versus"/>
@@ -699,27 +483,19 @@
   <input type="optionlist" name="date-spec-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-       (match-all (= (compare-date (get-received-date) ${versus}) 0))
-    </code>
+    <code>(= (compare-date (get-received-date) ${versus}) 0)</code>
    </option>
    <option value="is-not">
     <_title>is not</_title>
-    <code>
-       (match-all (not (= (compare-date (get-received-date) ${versus}) 0)))
-    </code>
+    <code>(not (= (compare-date (get-received-date) ${versus}) 0))</code>
    </option>
    <option value="before">
     <_title>is before</_title>
-    <code>
-       (match-all (&lt; (compare-date (get-received-date) ${versus}) 0))
-    </code>
+    <code>(&lt; (compare-date (get-received-date) ${versus}) 0)</code>
    </option>
    <option value="after">
     <_title>is after</_title>
-    <code>
-       (match-all (&gt; (compare-date (get-received-date) ${versus}) 0))
-    </code>
+    <code>(&gt; (compare-date (get-received-date) ${versus}) 0)</code>
    </option>
   </input>    
   <input type="datespec" name="versus"/>
@@ -738,7 +514,7 @@
     </option>
   </input>
   <input type="optionlist" name="versus">
-     <dynamic func="e_mail_labels_get_filter_options"/>
+    <dynamic func="e_mail_labels_get_filter_options"/>
   </input>
  </part>
 
@@ -747,27 +523,19 @@
   <input type="optionlist" name="score-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-       (match-all (= (cast-int (user-tag "score")) ${versus}))
-    </code>
+    <code>(= (cast-int (user-tag "score")) ${versus})</code>
    </option>
    <option value="is-not">
     <_title>is not</_title>
-    <code>
-       (match-all (not (= (cast-int (user-tag "score")) ${versus})))
-    </code>
+    <code>(not (= (cast-int (user-tag "score")) ${versus}))</code>
    </option>
    <option value="greater-than">
     <_title>is greater than</_title>
-    <code>
-       (match-all (&gt; (cast-int (user-tag "score")) ${versus}))
-    </code>
+    <code>(&gt; (cast-int (user-tag "score")) ${versus})</code>
    </option>
    <option value="less-than">
     <_title>is less than</_title>
-    <code>
-       (match-all (&lt; (cast-int (user-tag "score")) ${versus}))
-    </code>
+    <code>(&lt; (cast-int (user-tag "score")) ${versus})</code>
    </option>
   </input>
   <input type="score" name="versus"/>
@@ -778,27 +546,19 @@
   <input type="optionlist" name="size-type">
    <option value="greater-than">
     <_title>is greater than</_title>
-    <code>
-       (match-all (&gt; (get-size) ${versus}))
-    </code>
+    <code>(&gt; (get-size) ${versus})</code>
    </option>
    <option value="greater-than-or-equal">
     <_title>is greater than or equal to</_title>
-    <code>
-       (match-all (or (&gt; (get-size) ${versus}) (= (get-size) ${versus})))
-    </code>
+    <code>(or (&gt; (get-size) ${versus}) (= (get-size) ${versus}))</code>
    </option>
    <option value="less-than-or-equal">
     <_title>is less than or equal to</_title>
-    <code>
-       (match-all (or (&lt; (get-size) ${versus}) (= (get-size) ${versus})))
-    </code>
+    <code>(or (&lt; (get-size) ${versus}) (= (get-size) ${versus}))</code>
    </option>
    <option value="less-than">
     <_title>is less than</_title>
-    <code>
-       (match-all (&lt; (get-size) ${versus}))
-    </code>
+    <code>(&lt; (get-size) ${versus})</code>
    </option>
   </input>
   <input type="integer" name="versus"/>
@@ -809,15 +569,11 @@
   <input type="optionlist" name="match-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-     (match-all (system-flag ${flag}))
-    </code>
+    <code>(system-flag ${flag})</code>
    </option>
    <option value="is not">
     <_title>is not</_title>
-    <code>
-     (match-all (not (system-flag ${flag})))
-    </code>
+    <code>(not (system-flag ${flag}))</code>
    </option>
   </input>
   <input type="optionlist" name="flag">
@@ -844,27 +600,19 @@
   <input type="optionlist" name="match-type">
    <option value="is">
     <_title>is Flagged</_title>
-    <code>
-     (match-all (not (= (user-tag "follow-up") "")))
-    </code>
+    <code>(not (= (user-tag "follow-up") ""))</code>
    </option>
    <option value="is not">
     <_title>is not Flagged</_title>
-    <code>
-     (match-all (= (user-tag "follow-up") ""))
-    </code>
+    <code>(= (user-tag "follow-up") "")</code>
    </option>
    <option value="is completed">
     <_title>is Completed</_title>
-    <code>
-       (match-all (and (not (= (user-tag "follow-up") "")) (not (= (user-tag "completed-on") ""))))
-    </code>
+    <code>(and (not (= (user-tag "follow-up") "")) (not (= (user-tag "completed-on") "")))</code>
    </option>
    <option value="is not completed">
     <_title>is not Completed</_title>
-    <code>
-       (match-all (and (not (= (user-tag "follow-up") "")) (= (user-tag "completed-on") "")))
-    </code>
+    <code>(and (not (= (user-tag "follow-up") "")) (= (user-tag "completed-on") ""))</code>
    </option>
   </input>
  </part>
@@ -874,15 +622,11 @@
   <input type="optionlist" name="match-type">
    <option value="exist">
     <_title>Exist</_title>
-    <code>
-     (match-all (system-flag "Attachments"))
-    </code>
+    <code>(system-flag "Attachments")</code>
    </option>
    <option value="not exist">
     <_title>Do Not Exist</_title>
-    <code>
-     (match-all (not (system-flag "Attachments")))
-    </code>
+    <code>(not (system-flag "Attachments"))</code>
    </option>
   </input>
  </part>
@@ -892,15 +636,11 @@
   <input type="optionlist" name="match-type">
    <option value="exist">
     <_title>Exist</_title>
-    <code>
-     (match-all (user-flag "$has_note"))
-    </code>
+    <code>(user-flag "$has_note")</code>
    </option>
    <option value="not exist">
     <_title>Do Not Exist</_title>
-    <code>
-     (match-all (not (user-flag "$has_note")))
-    </code>
+    <code>(not (user-flag "$has_note"))</code>
    </option>
   </input>
  </part>
@@ -909,20 +649,20 @@
   <_title>Mailing list</_title>
    <input type="optionlist" name="mlist-type">
     <option value="is">
-        <_title>is</_title>
-        <code>(match-all (header-matches "x-camel-mlist" ${mlist}))</code>
+     <_title>is</_title>
+     <code>(header-matches "x-camel-mlist" ${mlist})</code>
     </option>
     <option value="is not">
-        <_title>is not</_title>
-        <code>(match-all (not (header-matches "x-camel-mlist" ${mlist})))</code>
+     <_title>is not</_title>
+     <code>(not (header-matches "x-camel-mlist" ${mlist}))</code>
     </option>
     <option value="contains">
-        <_title>contains</_title>
-        <code>(match-all (header-contains "x-camel-mlist" ${mlist}))</code>
+     <_title>contains</_title>
+     <code>(header-contains "x-camel-mlist" ${mlist})</code>
     </option>
     <option value="not contains">
-        <_title>does not contain</_title>
-        <code>(match-all (not (header-contains "x-camel-mlist" ${mlist})))</code>
+     <_title>does not contain</_title>
+     <code>(not (header-contains "x-camel-mlist" ${mlist}))</code>
     </option>
    </input>
    <input type="string" name="mlist"/>
@@ -933,26 +673,20 @@
   <input type="optionlist" name="match-type">
    <option value="header">
     <_title>Message Header</_title>
-    <code>
-       (match-all (header-full-regex ${expression}))
-    </code>
+    <code>(header-full-regex ${expression})</code>
    </option>
    <option value="body">
     <_title>Message Body</_title>
-    <code>
-       (match-all (body-regex ${expression}))
-    </code>
+    <code>(body-regex ${expression})</code>
    </option>
   </input>
   <input type="regex" name="expression"/>
  </part>
 
-    <part name="all">
-      <_title>Match All</_title>
-      <code>
-       (match-all #t)
-      </code>
-    </part>
+ <part name="all">
+  <_title>Match All</_title>
+  <code>#t</code>
+ </part>
 
 </partset>
 
diff --git a/src/mail/vfoldertypes.xml.in b/src/mail/vfoldertypes.xml.in
index e56f752a42..90066c6497 100644
--- a/src/mail/vfoldertypes.xml.in
+++ b/src/mail/vfoldertypes.xml.in
@@ -2,47 +2,39 @@
 <filterdescription>
 <partset>
  <part name="sender">
-  <_title>Sender</_title>
+   <_title>Sender</_title>
    <input type="optionlist" name="sender-type">
     <option value="contains">
-        <_title>contains</_title>
-       <code>(match-all (header-contains "From" ${sender}))</code>
+     <_title>contains</_title>
+     <code>(header-contains "From" ${sender})</code>
     </option>
     <option value="not contains">
-        <_title>does not contain</_title>
-        <code>(match-all (not (header-contains "From" ${sender})))</code>
+     <_title>does not contain</_title>
+     <code>(not (header-contains "From" ${sender}))</code>
     </option>
     <option value="is">
-        <_title>is</_title>
-       <code>(match-all (header-matches "From" ${sender}))</code>
+     <_title>is</_title>
+     <code>(header-matches "From" ${sender})</code>
     </option>
     <option value="is not">
-        <_title>is not</_title>
-        <code>(match-all (not (header-matches "From" ${sender})))</code>
+     <_title>is not</_title>
+     <code>(not (header-matches "From" ${sender}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (header-starts-with "From" ${sender}))
-     </code>
+     <code>(header-starts-with "From" ${sender})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (header-starts-with "From" ${sender})))
-     </code>
+     <code>(not (header-starts-with "From" ${sender}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (header-ends-with "From" ${sender}))
-     </code>
+     <code>(header-ends-with "From" ${sender})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (header-ends-with "From" ${sender})))
-     </code>
+     <code>(not (header-ends-with "From" ${sender}))</code>
     </option>
    </input>
    <input type="string" name="sender" allow-empty="false"/>
@@ -53,63 +45,35 @@
    <input type="optionlist" name="recipient-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (or (header-contains "To" ${recipient})
-                      (header-contains "Cc" ${recipient})))
-     </code>
+     <code>(or (header-contains "To" ${recipient}) (header-contains "Cc" ${recipient}))</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (or
-                          (header-contains "To" ${recipient})
-                         (header-contains "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-contains "To" ${recipient}) (header-contains "Cc" ${recipient})))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (or (header-matches "To" ${recipient})
-                      (header-matches "Cc" ${recipient})))
-     </code>
+     <code>(or (header-matches "To" ${recipient}) (header-matches "Cc" ${recipient}))</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (or
-               (header-matches "To" ${recipient})
-              (header-matches "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-matches "To" ${recipient}) (header-matches "Cc" ${recipient})))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (or (header-starts-with "To" ${recipient})
-                      (header-starts-with "Cc" ${recipient})))
-     </code>
+     <code>(or (header-starts-with "To" ${recipient}) (header-starts-with "Cc" ${recipient}))</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (or
-               (header-starts-with "To" ${recipient})
-              (header-starts-with "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-starts-with "To" ${recipient}) (header-starts-with "Cc" ${recipient})))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (or (header-ends-with "To" ${recipient})
-                      (header-ends-with "Cc" ${recipient})))
-     </code>
+     <code>(or (header-ends-with "To" ${recipient}) (header-ends-with "Cc" ${recipient}))</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (or
-               (header-ends-with "To" ${recipient})
-              (header-ends-with "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-ends-with "To" ${recipient}) (header-ends-with "Cc" ${recipient})))</code>
     </option>
    </input>
    <input type="address" name="recipient" allow-empty="false"/>
@@ -120,63 +84,43 @@
    <input type="optionlist" name="recipient-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains "To" ${recipient}))
-     </code>
+     <code>(header-contains "To" ${recipient})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains "To" ${recipient})))
-     </code>
+     <code>(not (header-contains "To" ${recipient}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches "To" ${recipient}))
-     </code>
+     <code>(header-matches "To" ${recipient})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches "To" ${recipient})))
-     </code>
+     <code>(not (header-matches "To" ${recipient}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (header-starts-with "To" ${recipient}))
-     </code>
+     <code>(header-starts-with "To" ${recipient})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (header-starts-with "To" ${recipient})))
-     </code>
+     <code>(not (header-starts-with "To" ${recipient}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (header-ends-with "To" ${recipient}))
-     </code>
+     <code>(header-ends-with "To" ${recipient})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (header-ends-with "To" ${recipient})))
-     </code>
+     <code>(not (header-ends-with "To" ${recipient}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-       (match-all (header-soundex "To" ${recipient}))
-     </code>
+     <code>(header-soundex "To" ${recipient})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-       (match-all (not (header-soundex "To" ${recipient})))
-     </code>
+     <code>(not (header-soundex "To" ${recipient}))</code>
     </option>
    </input>
    <input type="address" name="recipient" allow-empty="false"/>
@@ -187,63 +131,43 @@
    <input type="optionlist" name="recipient-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains "Cc" ${recipient}))
-     </code>
+     <code>(header-contains "Cc" ${recipient})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains "Cc" ${recipient})))
-     </code>
+     <code>(not (header-contains "Cc" ${recipient}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches "Cc" ${recipient}))
-     </code>
+     <code>(header-matches "Cc" ${recipient})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches "Cc" ${recipient})))
-     </code>
+     <code>(not (header-matches "Cc" ${recipient}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (header-starts-with "Cc" ${recipient}))
-     </code>
+     <code>(header-starts-with "Cc" ${recipient})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (header-starts-with "Cc" ${recipient})))
-     </code>
+     <code>(not (header-starts-with "Cc" ${recipient}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (header-ends-with "Cc" ${recipient}))
-     </code>
+     <code>(header-ends-with "Cc" ${recipient})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (header-ends-with "Cc" ${recipient})))
-     </code>
+     <code>(not (header-ends-with "Cc" ${recipient}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-       (match-all (header-soundex "Cc" ${recipient}))
-     </code>
+     <code>(header-soundex "Cc" ${recipient})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-       (match-all (not (header-soundex "Cc" ${recipient})))
-     </code>
+     <code>(not (header-soundex "Cc" ${recipient}))</code>
     </option>
    </input>
    <input type="address" name="recipient" allow-empty="false"/>
@@ -254,63 +178,43 @@
    <input type="optionlist" name="recipient-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains "Bcc" ${recipient}))
-     </code>
+     <code>(header-contains "Bcc" ${recipient})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-contains "Bcc" ${recipient}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches "Bcc" ${recipient}))
-     </code>
+     <code>(header-matches "Bcc" ${recipient})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-matches "Bcc" ${recipient}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (header-starts-with "Bcc" ${recipient}))
-     </code>
+     <code>(header-starts-with "Bcc" ${recipient})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (header-starts-with "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-starts-with "Bcc" ${recipient}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (header-ends-with "Bcc" ${recipient}))
-     </code>
+     <code>(header-ends-with "Bcc" ${recipient})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (header-ends-with "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-ends-with "Bcc" ${recipient}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-       (match-all (header-soundex "Bcc" ${recipient}))
-     </code>
+     <code>(header-soundex "Bcc" ${recipient})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-       (match-all (not (header-soundex "Bcc" ${recipient})))
-     </code>
+     <code>(not (header-soundex "Bcc" ${recipient}))</code>
     </option>
    </input>
    <input type="address" name="recipient" allow-empty="false"/>
@@ -321,71 +225,35 @@
    <input type="optionlist" name="recipient-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (or (header-contains "From" ${recipient})
-                      (header-contains "To" ${recipient})
-                      (header-contains "Cc" ${recipient})))
-     </code>
+     <code>(or (header-contains "From" ${recipient}) (header-contains "To" ${recipient}) (header-contains 
"Cc" ${recipient}))</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (or
-                          (header-contains "From" ${recipient})
-                          (header-contains "To" ${recipient})
-                          (header-contains "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-contains "From" ${recipient}) (header-contains "To" ${recipient}) 
(header-contains "Cc" ${recipient})))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (or (header-matches "From" ${recipient})
-                      (header-matches "To" ${recipient})
-                      (header-matches "Cc" ${recipient})))
-     </code>
+     <code>(or (header-matches "From" ${recipient}) (header-matches "To" ${recipient}) (header-matches "Cc" 
${recipient}))</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (or
-               (header-matches "From" ${recipient})
-               (header-matches "To" ${recipient})
-               (header-matches "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-matches "From" ${recipient}) (header-matches "To" ${recipient}) (header-matches 
"Cc" ${recipient})))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-        (match-all (or (header-starts-with "From" ${recipient})
-                      (header-starts-with "To" ${recipient})
-                      (header-starts-with "Cc" ${recipient})))
-     </code>
+     <code>(or (header-starts-with "From" ${recipient}) (header-starts-with "To" ${recipient}) 
(header-starts-with "Cc" ${recipient}))</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-        (match-all (not (or
-               (header-starts-with "From" ${recipient})
-               (header-starts-with "To" ${recipient})
-               (header-starts-with "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-starts-with "From" ${recipient}) (header-starts-with "To" ${recipient}) 
(header-starts-with "Cc" ${recipient})))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-        (match-all (or (header-ends-with "From" ${recipient})
-                      (header-ends-with "To" ${recipient})
-                      (header-ends-with "Cc" ${recipient})))
-     </code>
+     <code>(or (header-ends-with "From" ${recipient}) (header-ends-with "To" ${recipient}) (header-ends-with 
"Cc" ${recipient}))</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-        (match-all (not (or
-               (header-ends-with "From" ${recipient})
-               (header-ends-with "To" ${recipient})
-               (header-ends-with "Cc" ${recipient}))))
-     </code>
+     <code>(not (or (header-ends-with "From" ${recipient}) (header-ends-with "To" ${recipient}) 
(header-ends-with "Cc" ${recipient})))</code>
     </option>
    </input>
    <input type="address" name="recipient" allow-empty="false"/>
@@ -396,63 +264,43 @@
    <input type="optionlist" name="subject-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains "Subject" ${subject}))
-     </code>
+     <code>(header-contains "Subject" ${subject})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains "Subject" ${subject})))
-     </code>
+     <code>(not (header-contains "Subject" ${subject}))</code>
     </option>
     <option value="has-words">
      <_title>has words</_title>
-     <code>
-       (match-all (header-has-words "Subject" ${subject}))
-     </code>
+     <code>(header-has-words "Subject" ${subject})</code>
     </option>
     <option value="not has-words">
      <_title>does not have words</_title>
-     <code>
-       (match-all (not (header-has-words "Subject" ${subject})))
-     </code>
+     <code>(not (header-has-words "Subject" ${subject}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches "Subject" ${subject}))
-     </code>
+     <code>(header-matches "Subject" ${subject})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches "Subject" ${subject})))
-     </code>
+     <code>(not (header-matches "Subject" ${subject}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-       (match-all (header-starts-with "Subject" ${subject}))
-     </code>
+     <code>(header-starts-with "Subject" ${subject})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-       (match-all (not (header-starts-with "Subject" ${subject})))
-     </code>
+     <code>(not (header-starts-with "Subject" ${subject}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-       (match-all (header-ends-with "Subject" ${subject}))
-     </code>
+     <code>(header-ends-with "Subject" ${subject})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-       (match-all (not (header-ends-with "Subject" ${subject})))
-     </code>
+     <code>(not (header-ends-with "Subject" ${subject}))</code>
     </option>
    </input>
    <input type="string" name="subject"/>
@@ -464,87 +312,59 @@
    <input type="optionlist" name="header-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains ${header-field} ${word}))
-     </code>
+     <code>(header-contains ${header-field} ${word})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains ${header-field} ${word})))
-     </code>
+     <code>(not (header-contains ${header-field} ${word}))</code>
     </option>
     <option value="has-words">
      <_title>has words</_title>
-     <code>
-       (match-all (header-has-words ${header-field} ${word}))
-     </code>
+     <code>(header-has-words ${header-field} ${word})</code>
     </option>
     <option value="not has-words">
      <_title>does not have words</_title>
-     <code>
-       (match-all (not (header-has-words ${header-field} ${word})))
-     </code>
+     <code>(not (header-has-words ${header-field} ${word}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches ${header-field} ${word}))
-     </code>
+     <code>(header-matches ${header-field} ${word})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches ${header-field} ${word})))
-     </code>
+     <code>(not (header-matches ${header-field} ${word}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-       (match-all (header-starts-with ${header-field} ${word}))
-     </code>
+     <code>(header-starts-with ${header-field} ${word})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-       (match-all (not (header-starts-with ${header-field} ${word})))
-     </code>
+     <code>(not (header-starts-with ${header-field} ${word}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-       (match-all (header-ends-with ${header-field} ${word}))
-     </code>
+     <code>(header-ends-with ${header-field} ${word})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-       (match-all (not (header-ends-with ${header-field} ${word})))
-     </code>
+     <code>(not (header-ends-with ${header-field} ${word}))</code>
     </option>
     <option value="exists">
      <_title>exists</_title>
-     <code>
-       (match-all (header-exists ${header-field}))
-     </code>
+     <code>(header-exists ${header-field})</code>
     </option>
     <option value="not exists">
      <_title>does not exist</_title>
-     <code>
-       (match-all (not (header-exists ${header-field})))
-     </code>
+     <code>(not (header-exists ${header-field}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-        (match-all (header-soundex ${header-field} ${word}))
-     </code>
+     <code>(header-soundex ${header-field} ${word})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-        (match-all (not (header-soundex ${header-field} ${word})))
-     </code>
+     <code>(not (header-soundex ${header-field} ${word}))</code>
     </option>
    </input>
    <input type="string" name="word"/>
@@ -555,75 +375,51 @@
    <input type="optionlist" name="header-type">
     <option value="contains">
      <_title>contains</_title>
-     <code>
-       (match-all (header-contains "" ${word}))
-     </code>
+     <code>(header-contains "" ${word})</code>
     </option>
     <option value="not contains">
      <_title>does not contain</_title>
-     <code>
-       (match-all (not (header-contains "" ${word})))
-     </code>
+     <code>(not (header-contains "" ${word}))</code>
     </option>
     <option value="has-words">
      <_title>has words</_title>
-     <code>
-       (match-all (header-has-words "" ${word}))
-     </code>
+     <code>(header-has-words "" ${word})</code>
     </option>
     <option value="not has-words">
      <_title>does not have words</_title>
-     <code>
-       (match-all (not (header-has-words "" ${word})))
-     </code>
+     <code>(not (header-has-words "" ${word}))</code>
     </option>
     <option value="is">
      <_title>is</_title>
-     <code>
-       (match-all (header-matches "" ${word}))
-     </code>
+     <code>(header-matches "" ${word})</code>
     </option>
     <option value="is not">
      <_title>is not</_title>
-     <code>
-       (match-all (not (header-matches "" ${word})))
-     </code>
+     <code>(not (header-matches "" ${word}))</code>
     </option>
     <option value="starts with">
      <_title>starts with</_title>
-     <code>
-       (match-all (header-starts-with "" ${word}))
-     </code>
+     <code>(header-starts-with "" ${word})</code>
     </option>
     <option value="not starts with">
      <_title>does not start with</_title>
-     <code>
-       (match-all (not (header-starts-with "" ${word})))
-     </code>
+     <code>(not (header-starts-with "" ${word}))</code>
     </option>
     <option value="ends with">
      <_title>ends with</_title>
-     <code>
-       (match-all (header-ends-with "" ${word}))
-     </code>
+     <code>(header-ends-with "" ${word})</code>
     </option>
     <option value="not ends with">
      <_title>does not end with</_title>
-     <code>
-       (match-all (not (header-ends-with "" ${word})))
-     </code>
+     <code>(not (header-ends-with "" ${word}))</code>
     </option>
     <option value="matches soundex">
      <_title>sounds like</_title>
-     <code>
-        (match-all (header-soundex "" ${word}))
-     </code>
+     <code>(header-soundex "" ${word})</code>
     </option>
     <option value="not match soundex">
      <_title>does not sound like</_title>
-     <code>
-        (match-all (not (header-soundex "" ${word})))
-     </code>
+     <code>(not (header-soundex "" ${word}))</code>
     </option>
    </input>
    <input type="string" name="word"/>
@@ -664,27 +460,19 @@
   <input type="optionlist" name="date-spec-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-       (match-all (= (compare-date (get-sent-date) ${versus}) 0))
-    </code>
+    <code>(= (compare-date (get-sent-date) ${versus}) 0)</code>
    </option>
    <option value="is-not">
     <_title>is not</_title>
-    <code>
-       (match-all (not (= (compare-date (get-sent-date) ${versus}) 0)))
-    </code>
+    <code>(not (= (compare-date (get-sent-date) ${versus}) 0))</code>
    </option>
    <option value="before">
     <_title>is before</_title>
-    <code>
-       (match-all (&lt; (compare-date (get-sent-date) ${versus}) 0))
-    </code>
+    <code>(&lt; (compare-date (get-sent-date) ${versus}) 0)</code>
    </option>
    <option value="after">
     <_title>is after</_title>
-    <code>
-       (match-all (&gt; (compare-date (get-sent-date) ${versus}) 0))
-    </code>
+    <code>(&gt; (compare-date (get-sent-date) ${versus}) 0)</code>
    </option>
   </input>    
   <input type="datespec" name="versus"/>
@@ -695,27 +483,19 @@
   <input type="optionlist" name="date-spec-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-       (match-all (= (compare-date (get-received-date) ${versus}) 0))
-    </code>
+    <code>(= (compare-date (get-received-date) ${versus}) 0)</code>
    </option>
    <option value="is-not">
     <_title>is not</_title>
-    <code>
-       (match-all (not (= (compare-date (get-received-date) ${versus}) 0)))
-    </code>
+    <code>(not (= (compare-date (get-received-date) ${versus}) 0))</code>
    </option>
    <option value="before">
     <_title>is before</_title>
-    <code>
-       (match-all (&lt; (compare-date (get-received-date) ${versus}) 0))
-    </code>
+    <code>(&lt; (compare-date (get-received-date) ${versus}) 0)</code>
    </option>
    <option value="after">
     <_title>is after</_title>
-    <code>
-       (match-all (&gt; (compare-date (get-received-date) ${versus}) 0))
-    </code>
+    <code>(&gt; (compare-date (get-received-date) ${versus}) 0)</code>
    </option>
   </input>    
   <input type="datespec" name="versus"/>
@@ -743,27 +523,19 @@
   <input type="optionlist" name="score-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-       (match-all (= (cast-int (user-tag "score")) ${versus}))
-    </code>
+    <code>(= (cast-int (user-tag "score")) ${versus})</code>
    </option>
    <option value="is-not">
     <_title>is not</_title>
-    <code>
-       (match-all (not (= (cast-int (user-tag "score")) ${versus})))
-    </code>
+    <code>(not (= (cast-int (user-tag "score")) ${versus}))</code>
    </option>
    <option value="greater-than">
     <_title>is greater than</_title>
-    <code>
-       (match-all (&gt; (cast-int (user-tag "score")) ${versus}))
-    </code>
+    <code>(&gt; (cast-int (user-tag "score")) ${versus})</code>
    </option>
    <option value="less-than">
     <_title>is less than</_title>
-    <code>
-       (match-all (&lt; (cast-int (user-tag "score")) ${versus}))
-    </code>
+    <code>(&lt; (cast-int (user-tag "score")) ${versus})</code>
    </option>
   </input>
   <input type="score" name="versus"/>
@@ -774,27 +546,19 @@
   <input type="optionlist" name="size-type">
    <option value="greater-than">
     <_title>is greater than</_title>
-    <code>
-       (match-all (&gt; (get-size) ${versus}))
-    </code>
+    <code>(&gt; (get-size) ${versus})</code>
    </option>
    <option value="greater-than-or-equal">
     <_title>is greater than or equal to</_title>
-    <code>
-       (match-all (or (&gt; (get-size) ${versus}) (= (get-size) ${versus})))
-    </code>
+    <code>(or (&gt; (get-size) ${versus}) (= (get-size) ${versus}))</code>
    </option>
    <option value="less-than-or-equal">
     <_title>is less than or equal to</_title>
-    <code>
-       (match-all (or (&lt; (get-size) ${versus}) (= (get-size) ${versus})))
-    </code>
+    <code>(or (&lt; (get-size) ${versus}) (= (get-size) ${versus}))</code>
    </option>
    <option value="less-than">
     <_title>is less than</_title>
-    <code>
-       (match-all (&lt; (get-size) ${versus}))
-    </code>
+    <code>(&lt; (get-size) ${versus})</code>
    </option>
   </input>
   <input type="integer" name="versus"/>
@@ -805,15 +569,11 @@
   <input type="optionlist" name="match-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-     (match-all (system-flag ${flag}))
-    </code>
+    <code>(system-flag ${flag})</code>
    </option>
    <option value="is not">
     <_title>is not</_title>
-    <code>
-     (match-all (not (system-flag ${flag})))
-    </code>
+    <code>(not (system-flag ${flag}))</code>
    </option>
   </input>
   <input type="optionlist" name="flag">
@@ -843,27 +603,19 @@
   <input type="optionlist" name="match-type">
    <option value="is">
     <_title>is Flagged</_title>
-    <code>
-     (match-all (not (= (user-tag "follow-up") "")))
-    </code>
+    <code>(not (= (user-tag "follow-up") ""))</code>
    </option>
    <option value="is not">
     <_title>is not Flagged</_title>
-    <code>
-     (match-all (= (user-tag "follow-up") ""))
-    </code>
+    <code>(= (user-tag "follow-up") "")</code>
    </option>
    <option value="is completed">
     <_title>is Completed</_title>
-    <code>
-       (match-all (and (not (= (user-tag "follow-up") "")) (not (= (user-tag "completed-on") ""))))
-    </code>
+    <code>(and (not (= (user-tag "follow-up") "")) (not (= (user-tag "completed-on") "")))</code>
    </option>
    <option value="is not completed">
     <_title>is not Completed</_title>
-    <code>
-       (match-all (and (not (= (user-tag "follow-up") "")) (= (user-tag "completed-on") "")))
-    </code>
+    <code>(and (not (= (user-tag "follow-up") "")) (= (user-tag "completed-on") ""))</code>
    </option>
   </input>
  </part>
@@ -873,15 +625,11 @@
   <input type="optionlist" name="match-type">
    <option value="exist">
     <_title>Exist</_title>
-    <code>
-     (match-all (system-flag "Attachments"))
-    </code>
+    <code>(system-flag "Attachments")</code>
    </option>
    <option value="not exist">
     <_title>Do Not Exist</_title>
-    <code>
-     (match-all (not (system-flag "Attachments")))
-    </code>
+    <code>(not (system-flag "Attachments"))</code>
    </option>
   </input>
  </part>
@@ -891,15 +639,11 @@
   <input type="optionlist" name="match-type">
    <option value="exist">
     <_title>Exist</_title>
-    <code>
-     (match-all (user-flag "$has_note"))
-    </code>
+    <code>(user-flag "$has_note")</code>
    </option>
    <option value="not exist">
     <_title>Do Not Exist</_title>
-    <code>
-     (match-all (not (user-flag "$has_note")))
-    </code>
+    <code>(not (user-flag "$has_note"))</code>
    </option>
   </input>
  </part>
@@ -908,20 +652,20 @@
   <_title>Mailing list</_title>
    <input type="optionlist" name="mlist-type">
     <option value="is">
-        <_title>is</_title>
-        <code>(match-all (header-matches "x-camel-mlist" ${mlist}))</code>
+      <_title>is</_title>
+      <code>(header-matches "x-camel-mlist" ${mlist})</code>
     </option>
     <option value="is not">
-        <_title>is not</_title>
-        <code>(match-all (not (header-matches "x-camel-mlist" ${mlist})))</code>
+     <_title>is not</_title>
+     <code>(not (header-matches "x-camel-mlist" ${mlist}))</code>
     </option>
     <option value="contains">
-        <_title>contains</_title>
-        <code>(match-all (header-contains "x-camel-mlist" ${mlist}))</code>
+     <_title>contains</_title>
+     <code>(header-contains "x-camel-mlist" ${mlist})</code>
     </option>
     <option value="not contains">
-        <_title>does not contain</_title>
-        <code>(match-all (not (header-contains "x-camel-mlist" ${mlist})))</code>
+     <_title>does not contain</_title>
+     <code>(not (header-contains "x-camel-mlist" ${mlist}))</code>
     </option>
    </input>
    <input type="string" name="mlist" allow-empty="false"/>
@@ -932,15 +676,11 @@
   <input type="optionlist" name="match-type">
    <option value="header">
     <_title>Message Header</_title>
-    <code>
-       (match-all (header-full-regex ${expression}))
-    </code>
+    <code>(header-full-regex ${expression})</code>
    </option>
    <option value="body">
     <_title>Message Body</_title>
-    <code>
-       (match-all (body-regex ${expression}))
-    </code>
+    <code>(body-regex ${expression})</code>
    </option>
   </input>
   <input type="regex" name="expression"/>
@@ -951,26 +691,20 @@
   <input type="optionlist" name="msglocation-type">
    <option value="is">
     <_title>is</_title>
-    <code>
-      (match-all (message-location ${folder}))
-    </code>
+    <code>(message-location ${folder})</code>
    </option>
    <option value="is-not">
     <_title>is not</_title>
-    <code>
-      (match-all (not (message-location ${folder})))
-    </code>
+    <code>(not (message-location ${folder}))</code>
    </option>
   </input>
   <input type="folder-curi" name="folder"/>
  </part>
 
-    <part name="all">
-      <_title>Match All</_title>
-      <code>
-       (match-all #t)
-      </code>
-    </part>
+ <part name="all">
+  <_title>Match All</_title>
+  <code>#t</code>
+ </part>
 
 </partset>
 </filterdescription>
diff --git a/src/modules/mail/e-mail-shell-view.c b/src/modules/mail/e-mail-shell-view.c
index f63c1ff1dd..8dcca65eca 100644
--- a/src/modules/mail/e-mail-shell-view.c
+++ b/src/modules/mail/e-mail-shell-view.c
@@ -595,8 +595,12 @@ mail_shell_view_construct_filter_message_thread (EMailShellView *mail_shell_view
 
        query = g_string_new ("");
 
-       if (with_query)
-               g_string_append_printf (query, "(and %s ", with_query);
+       if (with_query && *with_query) {
+               if (g_str_has_prefix (with_query, "(match-all ") || strstr (with_query, "(match-threads "))
+                       g_string_append_printf (query, "(and %s ", with_query);
+               else
+                       g_string_append_printf (query, "(and (match-all %s) ", with_query);
+       }
 
        g_string_append (query, "(match-threads \"all\" (match-all (uid");
 
@@ -611,7 +615,7 @@ mail_shell_view_construct_filter_message_thread (EMailShellView *mail_shell_view
 
        g_string_append (query, ")))");
 
-       if (with_query)
+       if (with_query && *with_query)
                g_string_append_c (query, ')');
 
        return g_string_free (query, FALSE);
@@ -748,6 +752,13 @@ filter:
 
        /* Apply selected filter. */
 
+       if (query && *query && !g_str_has_prefix (query, "(match-all ") && !strstr (query, "(match-threads 
")) {
+               /* Make sure the query is enclosed in "(match-all ...)", to traverse the folders' content */
+               temp = g_strconcat ("(match-all ", query, ")", NULL);
+               g_free (query);
+               query = temp;
+       }
+
        combo_box = e_shell_searchbar_get_filter_combo_box (searchbar);
        value = e_action_combo_box_get_current_value (combo_box);
 
@@ -761,17 +772,22 @@ filter:
                        break;
 
                case MAIL_FILTER_UNREAD_MESSAGES:
-                       temp = g_strdup_printf (
-                               "(and %s (match-all (not "
-                               "(system-flag \"Seen\"))))", query);
+                       if (query && *query) {
+                               temp = g_strdup_printf ("(and %s (match-all (not (system-flag \"Seen\"))))", 
query);
+                       } else {
+                               temp = g_strdup ("(match-all (not (system-flag \"Seen\")))");
+                       }
                        g_free (query);
                        query = temp;
                        break;
 
                case MAIL_FILTER_NO_LABEL:
                        string = g_string_sized_new (1024);
-                       g_string_append_printf (
-                               string, "(and %s (and ", query);
+                       if (query && *query)
+                               g_string_append_printf (string, "(and %s (and ", query);
+                       else
+                               g_string_append (string, "(and ");
+                       g_string_append (string, "(match-all ");
                        valid = gtk_tree_model_get_iter_first (
                                GTK_TREE_MODEL (label_store), &tree_iter);
                        while (valid) {
@@ -781,10 +797,10 @@ filter:
                                if (g_str_has_prefix (use_tag, "$Label"))
                                        use_tag += 6;
                                g_string_append_printf (
-                                       string, " (match-all (not (or "
+                                       string, " (not (or "
                                        "(= (user-tag \"label\") \"%s\") "
                                        "(user-flag \"$Label%s\") "
-                                       "(user-flag \"%s\"))))",
+                                       "(user-flag \"%s\")))",
                                        use_tag, use_tag, use_tag);
                                g_free (tag);
 
@@ -792,63 +808,71 @@ filter:
                                        GTK_TREE_MODEL (label_store),
                                        &tree_iter);
                        }
-                       g_string_append_len (string, "))", 2);
+                       if (query && *query)
+                               g_string_append (string, ")))");
+                       else
+                               g_string_append (string, "))");
                        g_free (query);
                        query = g_string_free (string, FALSE);
                        break;
 
                case MAIL_FILTER_READ_MESSAGES:
-                       temp = g_strdup_printf (
-                               "(and %s (match-all "
-                               "(system-flag \"Seen\")))", query);
+                       if (query && *query)
+                               temp = g_strdup_printf ("(and %s (match-all (system-flag \"Seen\")))", query);
+                       else
+                               temp = g_strdup ("(match-all (system-flag \"Seen\"))");
                        g_free (query);
                        query = temp;
                        break;
 
-               case MAIL_FILTER_LAST_5_DAYS_MESSAGES:
+               case MAIL_FILTER_LAST_5_DAYS_MESSAGES: {
+                       const gchar *date_ident;
+
                        if (em_utils_folder_is_sent (registry, folder))
-                               temp = g_strdup_printf (
-                                       "(and %s (match-all "
-                                       "(> (get-sent-date) "
-                                       "(- (get-current-date) 432000))))",
-                                       query);
+                               date_ident = "get-sent-date";
                        else
-                               temp = g_strdup_printf (
-                                       "(and %s (match-all "
-                                       "(> (get-received-date) "
-                                       "(- (get-current-date) 432000))))",
-                                       query);
+                               date_ident = "get-received-date";
+
+                       if (query && *query)
+                               temp = g_strdup_printf ("(and %s (match-all (> (%s) (- (get-current-date) 
432000))))", query, date_ident);
+                       else
+                               temp = g_strdup_printf ("(match-all (> (%s) (- (get-current-date) 432000)))", 
date_ident);
                        g_free (query);
                        query = temp;
-                       break;
+                       } break;
 
                case MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS:
-                       temp = g_strdup_printf (
-                               "(and %s (match-all "
-                               "(system-flag \"Attachments\")))", query);
+                       if (query && *query)
+                               temp = g_strdup_printf ("(and %s (match-all (system-flag \"Attachments\")))", 
query);
+                       else
+                               temp = g_strdup ("(match-all (system-flag \"Attachments\"))");
                        g_free (query);
                        query = temp;
                        break;
 
                case MAIL_FILTER_MESSAGES_WITH_NOTES:
-                       temp = g_strdup_printf (
-                               "(and %s (match-all (user-flag \"$has_note\")))", query);
+                       if (query && *query)
+                               temp = g_strdup_printf ("(and %s (match-all (user-flag \"$has_note\")))", 
query);
+                       else
+                               temp = g_strdup ("(match-all (user-flag \"$has_note\"))");
                        g_free (query);
                        query = temp;
                        break;
 
                case MAIL_FILTER_IMPORTANT_MESSAGES:
-                       temp = g_strdup_printf (
-                               "(and %s (match-all "
-                               "(system-flag \"Flagged\")))", query);
+                       if (query && *query)
+                               temp = g_strdup_printf ("(and %s (match-all (system-flag \"Flagged\")))", 
query);
+                       else
+                               temp = g_strdup ("(match-all (system-flag \"Flagged\"))");
                        g_free (query);
                        query = temp;
                        break;
 
                case MAIL_FILTER_MESSAGES_NOT_JUNK:
-                       temp = g_strdup_printf (
-                               "(and %s (match-all (not "
-                               "(system-flag \"junk\"))))", query);
+                       if (query && *query)
+                               temp = g_strdup_printf ("(and %s (match-all (not (system-flag \"junk\"))))", 
query);
+                       else
+                               temp = g_strdup ("(match-all (not (system-flag \"junk\")))");
                        g_free (query);
                        query = temp;
                        break;
@@ -875,12 +899,21 @@ filter:
                        use_tag = tag;
                        if (g_str_has_prefix (use_tag, "$Label"))
                                use_tag += 6;
-                       temp = g_strdup_printf (
-                               "(and %s (match-all (or "
-                               "(= (user-tag \"label\") \"%s\") "
-                               "(user-flag \"$Label%s\") "
-                               "(user-flag \"%s\"))))",
-                               query, use_tag, use_tag, use_tag);
+                       if (query && *query) {
+                               temp = g_strdup_printf (
+                                       "(and %s (match-all (or "
+                                       "(= (user-tag \"label\") \"%s\") "
+                                       "(user-flag \"$Label%s\") "
+                                       "(user-flag \"%s\"))))",
+                                       query, use_tag, use_tag, use_tag);
+                       } else {
+                               temp = g_strdup_printf (
+                                       "(match-all (or "
+                                       "(= (user-tag \"label\") \"%s\") "
+                                       "(user-flag \"$Label%s\") "
+                                       "(user-flag \"%s\")))",
+                                       use_tag, use_tag, use_tag);
+                       }
                        g_free (tag);
 
                        g_free (query);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]