Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: info-gnus-english@gnu.org
Subject: Re: wrong gnus-search in nnml folder
Date: Wed, 01 Feb 2023 22:17:58 -0800	[thread overview]
Message-ID: <87o7qcy4ix.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87h6w44v24.fsf@gmail.com>

Fernando de Morais <fernandodemorais.jf@gmail.com> writes:

> Hello Angel and Eric,
>
> Angel de Vicente <angel.vicente.garrido@gmail.com> writes:
>
>> What I don't get to work is compound queries like since:3d from:alex
>> (they work separetely, but nothing gets returned if I try to combine
>> two queries...
>
> I use mairix as my search engine on nnmaildir servers and this behavior
> has always annoyed me, although I wasn't able to figure out why it
> cannot perform this kind of search, until Eric pointed out the
> possibility of debugging `gnus-search-run-search'.

Please report all annoyance as a bug! :)

> The mairix command interprets each query as an individual argument.
> When we pass a query like:
>
> #+begin_example
> Query: from:alex since:3d
> #+end_example
>
> In `gnus-search-run-search' it will become a sole string
> ("f:alex d:20230129-"), and mairix will return nothing.
>
> Just for a simple experiment, I reevaluated the `gnus-search-run-search'
> with the following lines changed:
>
> --- #<buffer gnus-search.el.gz>
> +++ #<buffer temp.el>
> @@ -1332,7 +1332,8 @@
>  	  (message "Doing %s query on %s..." program groups)
>  	(message "Doing %s query..." program))
>        (setq proc (apply #'start-process (format "search-%s" server)
> -			buffer program cp-list))
> +			buffer program (flatten-list (mapcar #'split-string
> +							     cp-list))))
>        (while (process-live-p proc)
>  	(accept-process-output proc))
>        (setq exitstatus (process-exit-status proc))
>
> And the result of a search like the give example above was the same
> given by mairix via terminal.
>
>
> P.S.: To clarify, I'm using Emacs 28.2.

That's very interesting! And odd, since none of the other
command-line-type search engines seem to care that the whole query is
passed in as a single string. I wonder if that behavior is an accident,
though, and the mairix behavior is actually the one we should be
expecting. Instead of the patch above, would you confirm that eval'ing
the following produces the right behavior?

(cl-defmethod gnus-search-indexed-search-command ((engine gnus-search-mairix)
						  (qstring string)
						  query &optional _groups)
  (with-slots (switches config-file) engine
    (append `("--rcfile" ,config-file "-r")
	   switches
	   (when (alist-get 'thread query) (list "-t"))
	   (split-string qstring))))

Though I'll continue investigating this, and might end up implementing
this for all engines.

Thanks for the bug-hunting,
Eric



  reply	other threads:[~2023-02-02  6:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 11:35 Angel de Vicente
2023-01-30 17:45 ` Eric Abrahamsen
2023-01-30 18:14   ` Angel de Vicente
2023-01-30 18:27     ` Angel de Vicente
2023-01-30 18:46       ` Eric Abrahamsen
2023-01-30 20:54         ` Angel de Vicente
2023-01-30 21:18           ` Angel de Vicente
2023-01-30 22:34             ` Eric Abrahamsen
2023-01-30 23:22               ` Angel de Vicente
2023-01-31 18:31                 ` Angel de Vicente
2023-01-31 18:39                   ` Angel de Vicente
2023-02-01 18:05                   ` Eric Abrahamsen
2023-02-02  3:15                 ` Fernando de Morais
2023-02-02  6:17                   ` Eric Abrahamsen [this message]
2023-02-02 11:44                     ` Angel de Vicente
2023-02-02 12:06                     ` Fernando de Morais

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7qcy4ix.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=info-gnus-english@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).