From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/2] WIP: use new sort key/type
Date: Sun, 10 Dec 2017 11:49:56 -0400 [thread overview]
Message-ID: <20171210154956.4049-3-david@tethera.net> (raw)
In-Reply-To: <20171210154956.4049-1-david@tethera.net>
---
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
next prev parent reply other threads:[~2017-12-10 15:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-10 15:49 Proposed New sort API David Bremner
2017-12-10 15:49 ` [PATCH 1/2] WIP: groundwork for new sorting API David Bremner
2018-10-08 20:51 ` William Casarin
2018-10-20 11:51 ` David Bremner
2017-12-10 15:49 ` David Bremner [this message]
2017-12-10 19:37 ` Proposed New sort API William Casarin
2018-10-09 3:05 ` William Casarin
2018-10-20 11:43 ` David Bremner
2018-10-20 17:15 ` William Casarin
2018-10-21 11:44 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171210154956.4049-3-david@tethera.net \
--to=david@tethera.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).