[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wrong gnus-search in nnml folder

From: Eric Abrahamsen
Subject: Re: wrong gnus-search in nnml folder
Date: Wed, 01 Feb 2023 22:17:58 -0800
User-agent: Gnus/5.13 (Gnus v5.13)

Fernando de Morais <> writes:

> Hello Angel and Eric,
> Angel de Vicente <> 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")
           (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,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]