Gnus development mailing list
 help / color / mirror / Atom feed
* gnus-search configuration example for notmuch
@ 2022-03-21 16:10 Julien Cubizolles
  2022-03-21 23:33 ` Eric Abrahamsen
  0 siblings, 1 reply; 11+ messages in thread
From: Julien Cubizolles @ 2022-03-21 16:10 UTC (permalink / raw)
  To: ding

I can't get gnus-search to use notmuch as its search engine for a
maildir synced by offlineimap. Every search with G-G returns 

> Group nnselect:nnselect-87ee2vomnz.fsf contains no messages

whereas both a search with gnus-search-imap and with notmuch-search
return many messages.

The relevant parts of my conf are:

--8<---------------cut here---------------start------------->8---
(setq gnus-search-default-engines
      '((nnimap . gnus-search-notmuch)
        (nnselect . gnus-search-nnselect)

(setq gnus-secondary-select-methods
      '(
	(nnimap "FreeOffline"
		(nnimap-stream shell)
		(nnimap-shell-program "/usr/lib/dovecot/imap -o mail_location=maildir:$HOME/email/Maildir/Free:LAYOUT=fs")
		(nnimap-split-methods default)
		(nnimap-inbox "INBOX")
		(gnus-search-notmuch-remove-prefix "/home/wilk/email/Maildir/Free/")
		)
	))
--8<---------------cut here---------------end--------------->8---

I think the remove-prefix is fine since this is an example of (notmuch-show-get-filename)

> "/home/wilk/email/Maildir/Free/Sent/cur/1645551545.M308782P83819.sadhill,S=61554,W=62426:2,S"

Could a kind soul please display his or her configuration to give me
some pointers ? Also is there some way to run some sanity checks ? I've
looked at gnus-search-tests.el and it doesn't seem to check the search
engines.
-- 
Julien Cubizolles



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: gnus-search configuration example for notmuch
  2022-03-21 16:10 gnus-search configuration example for notmuch Julien Cubizolles
@ 2022-03-21 23:33 ` Eric Abrahamsen
  2022-03-22  8:16   ` Julien Cubizolles
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Abrahamsen @ 2022-03-21 23:33 UTC (permalink / raw)
  To: ding

Julien Cubizolles <j.cubizolles@free.fr> writes:

> I can't get gnus-search to use notmuch as its search engine for a
> maildir synced by offlineimap. Every search with G-G returns 

Hi!

It's not possible to use notmuch to index an nnimap server. notmuch
returns its search results as filenames, and nnimap needs its search
results as message ids. If you turn on full-text indexing in dovecot,
you can just use the default imap search engine, right?

Eric



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: gnus-search configuration example for notmuch
  2022-03-21 23:33 ` Eric Abrahamsen
@ 2022-03-22  8:16   ` Julien Cubizolles
  2022-03-22  9:58     ` Adam Sjøgren
  2022-03-22 15:11     ` Eric Abrahamsen
  0 siblings, 2 replies; 11+ messages in thread
From: Julien Cubizolles @ 2022-03-22  8:16 UTC (permalink / raw)
  To: ding

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Julien Cubizolles <j.cubizolles@free.fr> writes:
>
>> I can't get gnus-search to use notmuch as its search engine for a
>> maildir synced by offlineimap. Every search with G-G returns 
>
> Hi!
>
> It's not possible to use notmuch to index an nnimap server. notmuch
> returns its search results as filenames, and nnimap needs its search
> results as message ids. 

Thank you, it all makes sense now. Maybe that's also why it doesn't work
on nnml and nndraft either.

What backend can you use gnus-search-notmuch with then ? And what search
engines should you use with nnml and nndraft ? Am I right in assuming
that with the right gnus-search-engines set up gnus-search could search
through all backends and return the matching messages in a single
nnselect group ?

> If you turn on full-text indexing in dovecot, you can just use the
> default imap search engine, right?

gnus-search-imap is indeed working fine.

-- 
Julien Cubizolles



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: gnus-search configuration example for notmuch
  2022-03-22  8:16   ` Julien Cubizolles
@ 2022-03-22  9:58     ` Adam Sjøgren
  2022-03-22 10:28       ` Eric S Fraga
  2022-03-22 11:31       ` Julien Cubizolles
  2022-03-22 15:11     ` Eric Abrahamsen
  1 sibling, 2 replies; 11+ messages in thread
From: Adam Sjøgren @ 2022-03-22  9:58 UTC (permalink / raw)
  To: ding

Julien writes:

> What backend can you use gnus-search-notmuch with then ? And what search
> engines should you use with nnml and nndraft ?

I'm using notmuch with nnml - in gnus-secondary-select-methods I have:

    '(nnml ""
       (gnus-search-engine gnus-search-notmuch))

To search I put point on an nnml:-group and press G G.


To update the notmuch index I have:

    (defun asjo-notmuch-new ()
      "Run notmuch new"
      (start-process "notmuch" "*Notmuch*" "notmuch" "new"))

    (add-hook 'gnus-after-getting-new-news-hook 'asjo-notmuch-new)
    (add-hook 'gnus-started-hook 'asjo-notmuch-new)


  Best regards,

    Adam

-- 
 "Here we are again                                         Adam Sjøgren
  Waiting for the end"                                 asjo@koldfront.dk



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: gnus-search configuration example for notmuch
  2022-03-22  9:58     ` Adam Sjøgren
@ 2022-03-22 10:28       ` Eric S Fraga
  2022-03-22 11:31       ` Julien Cubizolles
  1 sibling, 0 replies; 11+ messages in thread
From: Eric S Fraga @ 2022-03-22 10:28 UTC (permalink / raw)
  To: ding

And I also use notmuch for nnml.  Works very well.

My configuration differs slightly from Adam's in that I use crontab
(externally to Emacs) to keep my notmuch database updated.
-- 
Eric S Fraga with org 9.5.2 in Emacs 29.0.50 on Debian 11.2



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: gnus-search configuration example for notmuch
  2022-03-22  9:58     ` Adam Sjøgren
  2022-03-22 10:28       ` Eric S Fraga
@ 2022-03-22 11:31       ` Julien Cubizolles
  1 sibling, 0 replies; 11+ messages in thread
From: Julien Cubizolles @ 2022-03-22 11:31 UTC (permalink / raw)
  To: ding

Adam Sjøgren <asjo@koldfront.dk> writes:

> Julien writes:
>
>> What backend can you use gnus-search-notmuch with then ? And what search
>> engines should you use with nnml and nndraft ?
>
> I'm using notmuch with nnml - in gnus-secondary-select-methods I have:
>
>     '(nnml ""
>        (gnus-search-engine gnus-search-notmuch))
>
> To search I put point on an nnml:-group and press G G.

I had a typo in my nnml configuration : it's now working. Thanks for
your help.
-- 
Julien Cubizolles



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: gnus-search configuration example for notmuch
  2022-03-22  8:16   ` Julien Cubizolles
  2022-03-22  9:58     ` Adam Sjøgren
@ 2022-03-22 15:11     ` Eric Abrahamsen
  2022-03-22 20:22       ` Dan Christensen
  1 sibling, 1 reply; 11+ messages in thread
From: Eric Abrahamsen @ 2022-03-22 15:11 UTC (permalink / raw)
  To: ding

Julien Cubizolles <j.cubizolles@free.fr> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Julien Cubizolles <j.cubizolles@free.fr> writes:
>>
>>> I can't get gnus-search to use notmuch as its search engine for a
>>> maildir synced by offlineimap. Every search with G-G returns 
>>
>> Hi!
>>
>> It's not possible to use notmuch to index an nnimap server. notmuch
>> returns its search results as filenames, and nnimap needs its search
>> results as message ids. 
>
> Thank you, it all makes sense now. Maybe that's also why it doesn't work
> on nnml and nndraft either.
>
> What backend can you use gnus-search-notmuch with then ? And what search
> engines should you use with nnml and nndraft ? Am I right in assuming
> that with the right gnus-search-engines set up gnus-search could search
> through all backends and return the matching messages in a single
> nnselect group ?

To add to what everyone else has said: most of the mail backends (nnml,
nnmaildir, etc) keep their messages as files on the file system, so any
search engine that indexes files and gives you full filenames back as
search results (including notmuch, namazu, mairix) will work with them.
It's really nnimap that is a special case, as you're not supposed to
know or care where/how it stores its messages, and instead use the
client/server interface.

And yes, the whole point of gnus-search and nnselect is that you can
search any number of groups and servers, using a single search query and
getting the results in a single group.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: gnus-search configuration example for notmuch
  2022-03-22 15:11     ` Eric Abrahamsen
@ 2022-03-22 20:22       ` Dan Christensen
  2022-03-23 16:37         ` Eric Abrahamsen
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Christensen @ 2022-03-22 20:22 UTC (permalink / raw)
  To: ding

On Mar 22, 2022, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:

> To add to what everyone else has said: most of the mail backends (nnml,
> nnmaildir, etc) keep their messages as files on the file system, so any
> search engine that indexes files and gives you full filenames back as
> search results (including notmuch, namazu, mairix) will work with them.
> It's really nnimap that is a special case, as you're not supposed to
> know or care where/how it stores its messages, and instead use the
> client/server interface.

I guess nnfolder is also a special case?  My mail is currently split
between nnfolder and nnimap (using dovecot), and my current search
engine is mairix, which can provide its results as a folder full of
files each containing a single message.  Right now I use nnmairix to
view my search results, but it is a bit buggy and doesn't have some
features than gnus-search and nnselect seem to have, so I wouldn't
mind switching.  But since I'm pretty familiar with the mairix search
syntax, I'd like to keep using mairix.  Is this not possible?

Dan



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: gnus-search configuration example for notmuch
  2022-03-22 20:22       ` Dan Christensen
@ 2022-03-23 16:37         ` Eric Abrahamsen
  2022-03-23 17:03           ` Dan Christensen
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Abrahamsen @ 2022-03-23 16:37 UTC (permalink / raw)
  To: ding

Dan Christensen <jdc@uwo.ca> writes:

> On Mar 22, 2022, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
>
>> To add to what everyone else has said: most of the mail backends (nnml,
>> nnmaildir, etc) keep their messages as files on the file system, so any
>> search engine that indexes files and gives you full filenames back as
>> search results (including notmuch, namazu, mairix) will work with them.
>> It's really nnimap that is a special case, as you're not supposed to
>> know or care where/how it stores its messages, and instead use the
>> client/server interface.
>
> I guess nnfolder is also a special case?  My mail is currently split
> between nnfolder and nnimap (using dovecot), and my current search
> engine is mairix, which can provide its results as a folder full of
> files each containing a single message.  Right now I use nnmairix to
> view my search results, but it is a bit buggy and doesn't have some
> features than gnus-search and nnselect seem to have, so I wouldn't
> mind switching.  But since I'm pretty familiar with the mairix search
> syntax, I'd like to keep using mairix.  Is this not possible?

I don't think nnfolder is a special case: as long as both the Gnus
backend and the search engine deal in absolute file paths, they should
be able to talk to one another. If something special needs to be done to
translate mairix search results into something that nnfolder can
understand, I'd like to know about that and implement it.

You can certainly continue to use mairix. nnmairix creates its own
search groups and populates them; mairix with gnus-search just returns a
list of file paths. If you like using mairix's search syntax, but want
to use the gnus-search syntax for nnimap, you can first set:

(setq gnus-search-use-parsed-queries t)

To parse queries by default, then use _unparsed_ queries for mairix
through one of a few approaches:

1. (setq gnus-search-mairix-raw-queries-p t): all queries against a
   mairix search engine will be unparsed.
2. Add (raw-queries-p t) to the config for one specific mairix search engine
3. Give a C-u prefix to the "G G" search command, for one single search

Note that any of these options mean you won't be able to issue a single
search against multiple groups belonging to nnfolder and nnimap at the
same time; you'll have to use separate searches.

HTH,
Eric



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: gnus-search configuration example for notmuch
  2022-03-23 16:37         ` Eric Abrahamsen
@ 2022-03-23 17:03           ` Dan Christensen
  2022-03-23 19:19             ` Eric Abrahamsen
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Christensen @ 2022-03-23 17:03 UTC (permalink / raw)
  To: ding

On Mar 23, 2022, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:

> Dan Christensen <jdc@uwo.ca> writes:
>
>> On Mar 22, 2022, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
>>
>>> To add to what everyone else has said: most of the mail backends (nnml,
>>> nnmaildir, etc) keep their messages as files on the file system, so any
>>> search engine that indexes files and gives you full filenames back as
>>> search results (including notmuch, namazu, mairix) will work with them.
>>> It's really nnimap that is a special case
>>
>> I guess nnfolder is also a special case?
> 
> I don't think nnfolder is a special case: as long as both the Gnus
> backend and the search engine deal in absolute file paths, they should
> be able to talk to one another. If something special needs to be done to
> translate mairix search results into something that nnfolder can
> understand, I'd like to know about that and implement it.

With nnfolder, each file contains an entire group's worth of messages.
So how can it work if mairix provides just a list of full filenames?

Dan



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: gnus-search configuration example for notmuch
  2022-03-23 17:03           ` Dan Christensen
@ 2022-03-23 19:19             ` Eric Abrahamsen
  0 siblings, 0 replies; 11+ messages in thread
From: Eric Abrahamsen @ 2022-03-23 19:19 UTC (permalink / raw)
  To: ding

Dan Christensen <jdc@uwo.ca> writes:

> On Mar 23, 2022, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
>
>> Dan Christensen <jdc@uwo.ca> writes:
>>
>>> On Mar 22, 2022, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
>>>
>>>> To add to what everyone else has said: most of the mail backends (nnml,
>>>> nnmaildir, etc) keep their messages as files on the file system, so any
>>>> search engine that indexes files and gives you full filenames back as
>>>> search results (including notmuch, namazu, mairix) will work with them.
>>>> It's really nnimap that is a special case
>>>
>>> I guess nnfolder is also a special case?
>> 
>> I don't think nnfolder is a special case: as long as both the Gnus
>> backend and the search engine deal in absolute file paths, they should
>> be able to talk to one another. If something special needs to be done to
>> translate mairix search results into something that nnfolder can
>> understand, I'd like to know about that and implement it.
>
> With nnfolder, each file contains an entire group's worth of messages.
> So how can it work if mairix provides just a list of full filenames?

It won't! Unless mairix can provide a matching line number, or some
other indication of where in the file the match is, we won't be able to
find the matching message. I can't think of any simple way around the problem.



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-03-23 19:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 16:10 gnus-search configuration example for notmuch Julien Cubizolles
2022-03-21 23:33 ` Eric Abrahamsen
2022-03-22  8:16   ` Julien Cubizolles
2022-03-22  9:58     ` Adam Sjøgren
2022-03-22 10:28       ` Eric S Fraga
2022-03-22 11:31       ` Julien Cubizolles
2022-03-22 15:11     ` Eric Abrahamsen
2022-03-22 20:22       ` Dan Christensen
2022-03-23 16:37         ` Eric Abrahamsen
2022-03-23 17:03           ` Dan Christensen
2022-03-23 19:19             ` Eric Abrahamsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).