Re: search engines

"Husain Alshehhi" <[email protected]> Mon, 10 Mar 2025 23:34:09 -0500
Newsgroups gmane.emacs.gnus.general
Message-ID <[email protected]>
Mekeor Melire <[email protected]> writes:

> ... until I read this.  Indeed, evaluating the following definition
> makes G G work for me:
>
> (cl-defmethod gnus-search-indexed-search-command ((engine gnus-search-mu)
> 						  (qstring string)
> 						  query &optional groups)
>   (let ((limit (alist-get 'limit query))
> 	(thread (alist-get 'thread query)))
>     (with-slots (switches config-directory) engine
>       `("find" 			; command must come first
> 	"--nocolor"		; mu will always give colored output otherwise
> 	,(format "--muhome=3D%s" config-directory)
> 	,@switches
> 	,(if thread "-r" "")
> 	,(if limit (format "--maxnum=3D%d" limit) "")
> 	,qstring
> 	;; ,@(if groups
> 	;;       `("and" "("
> 	;; 	,@(nbutlast (mapcan (lambda (x)
> 	;; 			      (list (concat "maildir:/" x) "or"))
> 	;; 			    groups))
> 	;; 	")")
> 	;;     "")
> 	"--format=3Dplain"
> 	"--fields=3Dl"))))
>

Thank you for the response.

I setup my mu with the following configuration:

--8<---------------cut here---------------start------------->8---
  (gnus-secondary-select-methods
   '((nnmaildir "@alshehhi.io"
                (gnus-search-engine gnus-search-mu)
                (directory "/home/husain/.nnmaildir")
                (config-directory "/home/husain/.cache/mu"))))
--8<---------------cut here---------------end--------------->8---

I evaluated the code you provided (with debug enabled). Now when I hover
over a group and hit G G and type the string 'hi', I get the following
error:

    Group nnselect:nnselect-87zfhsdwjp.fsf contains no messages

However, when I run

    $ mu --debug find 'hi' --muhome=3D/home/husain/.cache/mu --format=3Dpla=
in --fields=3Dl

I do get results. Here is mu logs:

    # logs from running the mu command from the cli
    Mar 10 23:29:16 localhost.localdomain mu[40997]: logging initialized; d=
ebug: yes, stdout/stderr: no
    Mar 10 23:29:16 localhost.localdomain mu[40997]: created Database() @ /=
home/husain/.cache/mu/xapian
    Mar 10 23:29:16 localhost.localdomain mu[40997]: sw: query: 'hi'; (rela=
ted:no; threads:no; ngrams:no; max-size:=E2=88=9E): finished after 9.2 ms
    Mar 10 23:29:16 localhost.localdomain mu[40997]: closing store @ /home/=
husain/.cache/mu/xapian
    Mar 10 23:29:16 localhost.localdomain mu[40997]: closing db


    # logs from running from within gnus
    Mar 10 23:29:27 localhost.localdomain mu[41016]: logging initialized; d=
ebug: yes, stdout/stderr: no
    Mar 10 23:29:27 localhost.localdomain mu[41016]: created Database() @ /=
home/husain/.cache/mu/xapian
    Mar 10 23:29:27 localhost.localdomain mu[41016]: sw: query: 'hi'; (rela=
ted:no; threads:no; ngrams:no; max-size:=E2=88=9E): finished after 8.9 ms
    Mar 10 23:29:28 localhost.localdomain mu[41016]: closing store @ /home/=
husain/.cache/mu/xapian
    Mar 10 23:29:28 localhost.localdomain mu[41016]: closing db

They are both identical. I suspect that mu is returning a response to
gnus, but gnus fails to display them. If you have any suggestions on how
to fix this, I very much appreciate it.

--=20
Husain