---
 lib/query.cc | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/query.cc b/lib/query.cc
index c3b228fb..0e529ca8 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -377,18 +377,18 @@ _notmuch_query_search_documents (notmuch_query_t *query,
 
        enquire.set_weighting_scheme (Xapian::BoolWeight());
 
-       switch (query->sort) {
-       case NOTMUCH_SORT_OLDEST_FIRST:
-           enquire.set_sort_by_value (NOTMUCH_VALUE_TIMESTAMP, false);
-           break;
-       case NOTMUCH_SORT_NEWEST_FIRST:
-           enquire.set_sort_by_value (NOTMUCH_VALUE_TIMESTAMP, true);
+       bool sort_reverse = false;
+       if (query->sort_type == NOTMUCH_SORT_TYPE_DESCENDING)
+           sort_reverse = true;
+
+       switch (query->sort_key) {
+       case NOTMUCH_SORT_KEY_TIMESTAMP:
+           enquire.set_sort_by_value (NOTMUCH_VALUE_TIMESTAMP, sort_reverse);
            break;
-       case NOTMUCH_SORT_MESSAGE_ID:
-           enquire.set_sort_by_value (NOTMUCH_VALUE_MESSAGE_ID, false);
+       case NOTMUCH_SORT_KEY_MESSAGE_ID:
+           enquire.set_sort_by_value (NOTMUCH_VALUE_MESSAGE_ID, sort_reverse);
            break;
-       case NOTMUCH_SORT_UNSORTED:
-       case NOTMUCH_SORT_UNSET:
+       case NOTMUCH_SORT_KEY_NONE:
            break;
        }
 
-- 
2.15.0

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to