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 645DD6DE0C67 for ; Fri, 9 Jun 2017 17:30:22 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.001 X-Spam-Level: X-Spam-Status: No, score=-0.001 tagged_above=-999 required=5 tests=[AWL=0.010, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] 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 b49HQFXdOR1O for ; Fri, 9 Jun 2017 17:30:21 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id BA3AB6DE0C64 for ; Fri, 9 Jun 2017 17:30:21 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1dJUHI-0007ti-FB; Fri, 09 Jun 2017 20:29:20 -0400 Received: (nullmailer pid 32480 invoked by uid 1000); Sat, 10 Jun 2017 00:30:18 -0000 From: David Bremner To: Ioan-Adrian Ratiu , notmuch@notmuchmail.org Subject: Re: [PATCH v2 03/11] notmuch-search: add filesize based sort order In-Reply-To: <20170518222708.30032-4-adi@adirat.com> References: <20170518222708.30032-1-adi@adirat.com> <20170518222708.30032-4-adi@adirat.com> Date: Fri, 09 Jun 2017 21:30:18 -0300 Message-ID: <8737b8elb9.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain 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: Sat, 10 Jun 2017 00:30:22 -0000 Ioan-Adrian Ratiu writes: > With this it now becomes possible to order the search results by > filesize using the --sort=biggest-first/smallest-first args. You should mention that you are also changing the library API, as well as adding new search options to notmuch-show and notmuch-search. > > 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. > */ At the moment the ABI is unstable on master, but that will change with the next release. Depending on when this is merged, it may need to bump the library version. I think just bumping LIBNOTMUCH_MINOR should be ok. > +++ 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 }, These new options should be documented, and tested.