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 64E196DE01EC for ; Sun, 21 Oct 2018 04:44:14 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.004 X-Spam-Level: X-Spam-Status: No, score=0.004 tagged_above=-999 required=5 tests=[AWL=0.005, 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 kV-hiiRzLqBu for ; Sun, 21 Oct 2018 04:44:13 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 676256DE01CE for ; Sun, 21 Oct 2018 04:44:13 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1gEC9Q-0000ik-PV; Sun, 21 Oct 2018 07:44:08 -0400 Received: (nullmailer pid 6114 invoked by uid 1000); Sun, 21 Oct 2018 11:44:07 -0000 From: David Bremner To: William Casarin , notmuch@notmuchmail.org Subject: Re: Proposed New sort API In-Reply-To: <871s8kletp.fsf@jb55.com> References: <20171210154956.4049-1-david@tethera.net> <87d0sj6cr6.fsf@jb55.com> <87lg6su9l1.fsf@tethera.net> <871s8kletp.fsf@jb55.com> Date: Sun, 21 Oct 2018 08:44:07 -0300 Message-ID: <87pnw3sewo.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 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: Sun, 21 Oct 2018 11:44:14 -0000 William Casarin writes: > David Bremner writes: > >> William Casarin writes: >> >>> Another thought I had that I wanted to throw out there for >>> consideration. It would be nice to be able to sort by "popular" threads, >>> aka sort by the number of messages in each thread. Not sure if this is >>> an easy thing to do at the query level? >> >> I don't see how to manage it as a xapian query. In the current database >> schema xapian doesn't really know about threads, except that messages >> know what thread they belong to. > > I noticed notmuch-search shows the number of messages in the thread, > perhaps you could just sort on that value when returning the results? AFAIU, currently there is no explicit sorting of threads returned, any sorting is a side effect of the sorting of the underlying messages. Since the threads are generated lazily, for queries generating a large number of threads such a post thread generation sorting would generate a noticeable delay. On the other hand, if it was optional, I guess that would be OK. It would introduce some complications and new code paths orthogonal to the other stuff we've been talking about. d