From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 3FCE26DE0C1B for ; Thu, 18 May 2017 15:25:49 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.155 X-Spam-Level: X-Spam-Status: No, score=-0.155 tagged_above=-999 required=5 tests=[AWL=0.057, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.211, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KXatp-Ljauzu for ; Thu, 18 May 2017 15:25:46 -0700 (PDT) Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by arlo.cworth.org (Postfix) with ESMTPS id 0619E6DE00C4 for ; Thu, 18 May 2017 15:25:42 -0700 (PDT) Received: by mail-wr0-f193.google.com with SMTP id g12so805138wrg.2 for ; Thu, 18 May 2017 15:25:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adirat-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=WSoYKDwD2LFzk8TDWbc5MqnH2f8TF8XJX3KjhSSseu8=; b=vx6B1XDcnvN1UtsHwPF7aUFeK+QvMxa4mKJDPKZXqIqD0eYElOfuDysR6a2uqMQxRq lMY/PR61oe/5k3WJZ8+/m1rvSZPXHBBA9tn/yktZ8y+IV36vj77fJEtam5AM6GcvQEPX getiCWN/JD1mxgjqF6ARoYO38g4JX3e/XH5+qD6w2qkSi46sUM4dbpupbhl4hHgaaWzw NpR5BDXAq+4FK7WPw6qRvZAJfXxw0Lg+Ofg88Ke2hlYcH3ukOlYelTx7Wkdvf+5t8/WM 2Con3JqvyCCPh5T/i/G/9DZqmSjh4kBgJz6kltbu8mUmujL9F1l5Hd6HQbIamXjv7c8i kIWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=WSoYKDwD2LFzk8TDWbc5MqnH2f8TF8XJX3KjhSSseu8=; b=nivBvZ36RIyMvsIpjCECbh2EYc88QodEvOK1Cm2swRLxcKS1QUpwMZVKWcgynVESWR JFNhA9D3vgv2CFm8zgvv5qGRFZUyso5pckPeoQXdXGPcMHOhwsCPw2Nob2TFFnNM4/BF krKbQ1OPR0lBTKPPArS0qL8zzqB61gGBIuXdoRbdkkeO0QpSgKbmikmgzMCwPpTU+VPM xX/VyTdCWUadF+3GPVs0hmEzQ5EmJnaPPpmNGJhwGj4bjUU3XH/b72xq6dIbdNJfTJGq +5JjSn/oGUJ/rvQpZRJtXfmRlhpIqniD95Bp6VXPH7N1NfaYw1sORFB2W3JMdL16Yidb Ffww== X-Gm-Message-State: AODbwcBrsx177FMVM1XDf5aeaopeg8lvE9Np1CjfWLQTtJl2A4mwkA62 DjUeQJNXq6dteP7erbg= X-Received: by 10.223.176.37 with SMTP id f34mr657783wra.93.1495146340504; Thu, 18 May 2017 15:25:40 -0700 (PDT) Received: from adiPC.adirat.com ([82.137.23.239]) by smtp.gmail.com with ESMTPSA id q16sm8141390wmg.2.2017.05.18.15.25.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2017 15:25:39 -0700 (PDT) From: Ioan-Adrian Ratiu To: notmuch@notmuchmail.org Subject: [PATCH v2 03/11] notmuch-search: add filesize based sort order Date: Fri, 19 May 2017 01:27:00 +0300 Message-Id: <20170518222708.30032-4-adi@adirat.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170518222708.30032-1-adi@adirat.com> References: <20170518222708.30032-1-adi@adirat.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 May 2017 22:25:49 -0000 With this it now becomes possible to order the search results by filesize using the --sort=biggest-first/smallest-first args. Signed-off-by: Ioan-Adrian Ratiu --- lib/notmuch.h | 8 ++++++++ lib/query.cc | 6 ++++++ notmuch-search.c | 2 ++ 3 files changed, 16 insertions(+) diff --git a/lib/notmuch.h b/lib/notmuch.h index f90458ce..b7bf3526 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -743,6 +743,14 @@ typedef enum { */ NOTMUCH_SORT_MESSAGE_ID, /** + * Smallest first. + */ + NOTMUCH_SORT_SMALLEST_FIRST, + /** + * Biggest first + */ + NOTMUCH_SORT_BIGGEST_FIRST, + /** * Do not sort. */ NOTMUCH_SORT_UNSORTED diff --git a/lib/query.cc b/lib/query.cc index 9c6ecc8d..72b725e3 100644 --- a/lib/query.cc +++ b/lib/query.cc @@ -330,6 +330,12 @@ _notmuch_query_search_documents (notmuch_query_t *query, case NOTMUCH_SORT_MESSAGE_ID: enquire.set_sort_by_value (NOTMUCH_VALUE_MESSAGE_ID, FALSE); break; + case NOTMUCH_SORT_SMALLEST_FIRST: + enquire.set_sort_by_value (NOTMUCH_VALUE_FILESIZE, FALSE); + break; + case NOTMUCH_SORT_BIGGEST_FIRST: + enquire.set_sort_by_value (NOTMUCH_VALUE_FILESIZE, TRUE); + break; case NOTMUCH_SORT_UNSORTED: break; } diff --git a/notmuch-search.c b/notmuch-search.c index 019e14ee..65ecfaab 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -778,6 +778,8 @@ static const notmuch_opt_desc_t common_options[] = { { NOTMUCH_OPT_KEYWORD, &search_context.sort, "sort", 's', (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST }, { "newest-first", NOTMUCH_SORT_NEWEST_FIRST }, + { "smallest-first", NOTMUCH_SORT_SMALLEST_FIRST }, + { "biggest-first", NOTMUCH_SORT_BIGGEST_FIRST }, { 0, 0 } } }, { NOTMUCH_OPT_KEYWORD, &search_context.format_sel, "format", 'f', (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON }, -- 2.13.0