From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/86533 Path: news.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.gnus.general Subject: Re: searching local mail stores Date: Tue, 05 Jan 2016 09:43:20 +0800 Message-ID: <87r3hwn6mf.fsf@ericabrahamsen.net> References: <87h9iwo8e6.fsf@gmail.com> <87twmwxler.fsf@tullinup.koldfront.dk> <87si2gx8lq.fsf@gmail.com> <8737ufyi9y.fsf@tullinup.koldfront.dk> <87d1tjkzw3.fsf@jnanam.net> <87lh87c9va.fsf@ericabrahamsen.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1451958285 3629 80.91.229.3 (5 Jan 2016 01:44:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Jan 2016 01:44:45 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M34760@lists.math.uh.edu Tue Jan 05 02:44:34 2016 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from lists1.math.uh.edu ([129.7.128.208]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aGGfp-0005OK-86 for ding-account@gmane.org; Tue, 05 Jan 2016 02:44:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.85) (envelope-from ) id 1aGGez-0005nJ-An; Mon, 04 Jan 2016 19:43:41 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by lists1.math.uh.edu with esmtps (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.85) (envelope-from ) id 1aGGew-0005mv-7W for ding@lists.math.uh.edu; Mon, 04 Jan 2016 19:43:38 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.85) (envelope-from ) id 1aGGeu-00022P-LA for ding@lists.math.uh.edu; Mon, 04 Jan 2016 19:43:37 -0600 Original-Received: from plane.gmane.org ([80.91.229.3]) by quimby.gnus.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1aGGes-0004sE-LE for ding@gnus.org; Tue, 05 Jan 2016 02:43:34 +0100 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aGGes-0004Sk-6w for ding@gnus.org; Tue, 05 Jan 2016 02:43:34 +0100 Original-Received: from 111.197.159.241 ([111.197.159.241]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Jan 2016 02:43:34 +0100 Original-Received: from eric by 111.197.159.241 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Jan 2016 02:43:34 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 113 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 111.197.159.241 User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1.50 (gnu/linux) Cancel-Lock: sha1:oGVWCAKldDVeIic6rxPzuvEs29E= X-Spam-Score: -0.1 (/) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:86533 Archived-At: Alan Schmitt writes: > Hello, > > (Sorry if you are seeing this as a duplicate. I tried to post it > through the gmane group but I'm not seeing it, so here it is again > directly to the mailing list.) > > On 2016-01-03 17:04, Eric Abrahamsen writes: > >>>> In .gnus I have added: >>>> >>>> (nnir-search-engine notmuch) >>>> >>>> in my mail-method ((nnml "")). >>>> >>>> I search by going to my email-topic and pressing GG. >>> >>> What else needs to be setup to use notmuch for search? >>> >>> (There's some info on setup here for instance: >>> http://roland.entierement.nu/blog/2010/09/08/gnus-dovecot-offlineimap-search-a-howto.html >>> ) >>> >>> Is that the sort of setup that needs doing first? >> >> This, but also ‘nnir-notmuch-remove-prefix’. Notmuch knows nothing about >> Gnus, it just knows where matching files are on your filesystem. Gnus >> only wants to know the filename relative to where it *already knows how >> to find the message*. You customize that option in order to match the >> two up. The option is basically copied from nnir-namazu-remove-prefix, >> which has a more useful docstring... > > I'm giving this a try, and I'm having a problem: whatever I try, I get > an error: > > gnus-select-newsgroup: Couldn't request group nnir:nnir-m2bn91ihar.fsf: > Search produced empty results. > > If I run the notmuch command on the command line, I see many results. > I tried to run edebug on the nnir-run-notmuch function, and it does > something strange. It actually populates a temporary buffer with the > results I see when running the command line, but then it seems to go > through these results discarding all of them. > > #+begin_src emacs-lisp > (while (not (eobp)) > (setq filenam (buffer-substring-no-properties (line-beginning-position) > (line-end-position)) > artno (file-name-nondirectory filenam) > dirnam (file-name-directory filenam)) > (forward-line 1) > > ;; don't match directories > (when (string-match article-pattern artno) > (when (not (null dirnam)) > > ;; maybe limit results to matching groups. > (when (or (not groupspec) > (string-match groupspec dirnam)) > (nnir-add-result dirnam artno "" prefix server artlist))))) > #+end_src > > The problem is in the matching of the name of the file (something like > "1451911994.M307856P59885.charm-ecran.irisa.fr,S=3270,W=3347:2,S") > against the pattern "^[0-9]+$", which fails and the found message is > ignored. > > Is this a bug in this function, or do I need additional configuration? > > Here are my server settings: > > (setq gnus-select-method > '(nnimap > "zimbra" > (nnimap-shell-program > "~/bin/dovecot_bin/imap -c ~/.dovecotzimbra.rc") > (nnimap-stream shell) > (nnimap-logout-timeout 1.0) > (nnir-search-engine notmuch) > (nnir-notmuch-remove-prefix "/Users/schmitta/.Maildir/zimbra/"))) > > (setq gnus-secondary-select-methods > '((nnimap > "local" > (nnimap-address "localhost") > (nnimap-server-port 143) > (nnimap-stream network) > (nnir-search-engine notmuch) > (nnir-notmuch-remove-prefix "/Users/schmitta/.Maildir/local")) > )) > I think the problem is that you can't actually use notmuch with the nnimap backend. Earlier in that function, you see that the "article-pattern" regexp is different depending on whether you're using an nnmaildir backend or not. In fact, if it uses the regexp associated with nnmaildir, it looks like your articles would probably match, and come out in the results. I don't really understand the reasoning behind this -- I suppose you could alter the function to always use the other regexp, and see if anything else breaks. But I think the idea is: if you're using an IMAP server, you're supposed to be letting the server do the searching, and give you the results. Searching the filesystem directly is kind of "going behind the server's back". I don't actually know if that would cause any real problems, but the code is definitely set up with that assumption in mind. Maybe try the FTS dovecot plugin? Eric