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 D86536DE00D3 for ; Tue, 6 Jun 2017 16:47:40 -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 D8NzTxL2Ylku for ; Tue, 6 Jun 2017 16:47:40 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 0D59D6DE00AC for ; Tue, 6 Jun 2017 16:47:39 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1dIOBL-0001Xg-U0; Tue, 06 Jun 2017 19:46:39 -0400 Received: (nullmailer pid 10984 invoked by uid 1000); Tue, 06 Jun 2017 23:47:37 -0000 From: David Bremner To: Ioan-Adrian Ratiu , notmuch@notmuchmail.org Subject: Re: [PATCH v2 01/11] lib: message: index message file sizes In-Reply-To: <20170518222708.30032-2-adi@adirat.com> References: <20170518222708.30032-1-adi@adirat.com> <20170518222708.30032-2-adi@adirat.com> Date: Tue, 06 Jun 2017 20:47:37 -0300 Message-ID: <8737bcfzl2.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: Tue, 06 Jun 2017 23:47:41 -0000 Ioan-Adrian Ratiu writes: > notmuch_status_t status; > + unsigned long filesize; > + char *filesize_str; > > status = _notmuch_message_file_get_mime_message (message_file, > &mime_message); > @@ -464,6 +466,14 @@ _notmuch_message_index_file (notmuch_message_t *message, > subject = g_mime_message_get_subject (mime_message); > _notmuch_message_gen_terms (message, "subject", subject); > > + filesize = _notmuch_message_file_get_size (message_file); > + filesize_str = talloc_asprintf(NULL, "%lu", filesize); > + if (! filesize_str) > + return NOTMUCH_STATUS_OUT_OF_MEMORY; > + > + _notmuch_message_add_term (message, "filesize", filesize_str); > + talloc_free (filesize_str); I wanted to see what the performance impact of this commit was, but unfortunately this breaks "notmuch new" (and most other things) as the prefix "filesize" is not defined yet. A handy way to see that this doesn't happen is to run % git rebase -i --exec "make clean test" origin/master before posting a series. Another preliminary question is why are you adding both a prefixed term and a value slot for file size? You can use the value slot to query. d