]> git.notmuchmail.org Git - notmuch/blobdiff - query.cc
Move read-only-archive hint from "notmuch setup" to "notmuch new"
[notmuch] / query.cc
index f66ee55649767639006fade6c22a6e963848adb7..c68bd37ad7fdb4bab5cc6f35cffcda8792b70919 100644 (file)
--- a/query.cc
+++ b/query.cc
@@ -92,13 +92,15 @@ notmuch_query_search (notmuch_query_t *query)
 
     try {
        Xapian::Enquire enquire (*notmuch->xapian_db);
-       Xapian::Query mail_query ("Kmail");
+       Xapian::Query mail_query (talloc_asprintf (query, "%s%s",
+                                                  _find_prefix ("type"),
+                                                  "mail"));
        Xapian::Query string_query, final_query;
        Xapian::MSet mset;
-       unsigned int flags = (Xapian::QueryParser::FLAG_BOOLEAN &
-                             Xapian::QueryParser::FLAG_PHRASE &
-                             Xapian::QueryParser::FLAG_LOVEHATE &
-                             Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE &
+       unsigned int flags = (Xapian::QueryParser::FLAG_BOOLEAN |
+                             Xapian::QueryParser::FLAG_PHRASE |
+                             Xapian::QueryParser::FLAG_LOVEHATE |
+                             Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |
                              Xapian::QueryParser::FLAG_WILDCARD);
 
        if (strcmp (query_string, "") == 0) {
@@ -112,10 +114,10 @@ notmuch_query_search (notmuch_query_t *query)
 
        switch (query->sort) {
        case NOTMUCH_SORT_DATE_OLDEST_FIRST:
-           enquire.set_sort_by_value (NOTMUCH_VALUE_DATE, FALSE);
+           enquire.set_sort_by_value (NOTMUCH_VALUE_TIMESTAMP, FALSE);
            break;
        case NOTMUCH_SORT_DATE_NEWEST_FIRST:
-           enquire.set_sort_by_value (NOTMUCH_VALUE_DATE, TRUE);
+           enquire.set_sort_by_value (NOTMUCH_VALUE_TIMESTAMP, TRUE);
            break;
        case NOTMUCH_SORT_MESSAGE_ID:
            enquire.set_sort_by_value (NOTMUCH_VALUE_MESSAGE_ID, FALSE);