--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 1288A431FC7\r
+ for <notmuch@notmuchmail.org>; Wed, 12 Jun 2013 01:49:04 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id oelC2iUGwudy for <notmuch@notmuchmail.org>;\r
+ Wed, 12 Jun 2013 01:48:56 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id ECCC1431FBC\r
+ for <notmuch@notmuchmail.org>; Wed, 12 Jun 2013 01:48:55 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1UmgjV-00082q-T6; Wed, 12 Jun 2013 09:48:48 +0100\r
+Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1UmgjV-0000Oa-Ir; Wed, 12 Jun 2013 09:48:45 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Nathan Clapham <nathan@claphams.info>, notmuch@notmuchmail.org\r
+Subject: Re: Searching with prefix :folder and --output=files\r
+In-Reply-To: <20130611213424.GA5028@Nathans-MacBook-Air.local>\r
+References: <20130611213424.GA5028@Nathans-MacBook-Air.local>\r
+User-Agent: Notmuch/0.15.2+171~ge2f30a2 (http://notmuchmail.org) Emacs/23.4.1\r
+ (i486-pc-linux-gnu)\r
+Date: Wed, 12 Jun 2013 09:48:44 +0100\r
+Message-ID: <87k3lz90k3.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 323a1351dffaa825e915be9071b253b9 (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.0\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.0 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.0 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 12 Jun 2013 08:49:04 -0000\r
+\r
+\r
+Hello\r
+\r
+This is the "expected" but, I agree, counter-intuitive result.\r
+\r
+First notmuch finds all the *messages* that match your query (ie\r
+which have an associated filename matching the folder: part of your\r
+query) and then it returns all filenames for these messages.\r
+\r
+I think that notmuch views a message (as determined by a message-id) as\r
+a single object in its database (it assumes that all copies are\r
+identical) so fixing this would not be easy.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+Nathan Clapham <nathan@claphams.info> writes:\r
+\r
+> Hi Everyone, \r
+>\r
+> Thanks for notmuch mail, it is a great program!\r
+>\r
+> I am having an issue searching with --output=files and the folder prefix.\r
+>\r
+> Could you please tell me if I've misunderstood something or perhaps there is \r
+> something wrong with my setup. Details of 2 examples below:\r
+>\r
+> $ notmuch --version\r
+> notmuch 0.15.2\r
+>\r
+> ----\r
+> 1. Archive folder\r
+>\r
+> Archive message #: 1356\r
+> Directory: $HOME/Mail/Gmail/[Gmail].Archive\r
+>\r
+> $ notmuch count folder:Archive\r
+> 1356\r
+>\r
+> $ notmuch search --output=messages folder:Archive | wc -l\r
+> 1356\r
+>\r
+> $ notmuch search --output=files folder:Archive | wc -l\r
+> 1572\r
+>\r
+> I wondered why I was getting more files listed in the last example. It turns out \r
+> some files are included from other folders. For example:\r
+>\r
+> Mail/Gmail/[Gmail].Sent Mail/cur/137075610...28e65ad90fc4f:2,S\r
+>\r
+> If I then do this:\r
+>\r
+> $ notmuch search --output=files folder:Archive | grep Archive | wc -l\r
+> 1356\r
+>\r
+> I get the correct count again.\r
+>\r
+> Different folders have a similar issue:\r
+>\r
+> 2. INBOX folder\r
+>\r
+> INBOX message #: 87\r
+> Directory: $HOME/Mail/Gmail/INBOX\r
+>\r
+> $ notmuch count folder:INBOX\r
+> 87\r
+>\r
+> $ notmuch search --output=messages folder:INBOX | wc -l\r
+> 87\r
+>\r
+> $ notmuch search --output=files folder:INBOX | wc -l\r
+> 97\r
+>\r
+> This time some messages from Archive are included:\r
+>\r
+> Mail/Gmail/[Gmail].Archive/cur/137077654...d7c877e152f72dd5ddbc11f:2,S\r
+>\r
+> $ notmuch search --output=files folder:INBOX | grep INBOX | wc -l\r
+> 87\r
+> ----\r
+>\r
+> I think this illustrates the problem I'm having. Maybe I don't understand how \r
+> the folder: prefix works? Perhaps it is my folder structure - the inclusion of \r
+> the imap prefix [Gmail].?? It seems the search is matching the correct messages \r
+> though, but the output of files includes messages from another folder. \r
+>\r
+> Any advice would be appreciated.\r
+>\r
+> Thanks,\r
+> Nathan.\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r