Subject: [bug#77833] Xapian cache/search proof of concept

From: Noé Lopez <[email-masked]>
Date: Mon, 28 Apr 2025 21:38:23 +0200

Gabriel Santos <[email-masked]> writes:

> Greetings,
>
> I subscribed to the channel[1] and installed the package[2], but
> couldn't get it working on my system. I then tried to install guile
> (which I didn't do because I already had it in my profile from some
> other package), but that was to no avail:
>
>>$ guix package -i guix-xsearch guile
>>The following packages will be installed:
>>   guile        3.0.9
>>   guix-xsearch 1.1
>>$ guix xsearch
>>guix: xsearch: command not found
>>hint: Did you mean `search'?
>>
>>Try `guix --help' for more information.

Did you try loading the package profile?

For me it works only after loading
".guix-profile/etc/profile". Sometimes it just feels like environment
variables never set themselves when you want them. I made sure that the
guix-xsearch package has the native-search-path! What else can I
possibly do?

>
> I then tried the "make env" shell from the channel and that worked:
>
>>$ make env
>>guix shell -m env/manifest.scm -- || exit 0	#ignore the shell’s return value
>>$ guix xsearch guix-search
>>name: guix-xsearch
>>[...]
>
> Additionally, trying to install it as package by adding the channel to the load
> path also doesn't work:
>
>>$ guix package -i guix-xsearch guile -L src/channel
>>The following packages will be installed:
>>   guix-xsearch 1.1
>>$ guix xsearch
>>guix: xsearch: command not found
>>hint: Did you mean `search'?
>>
>>Try `guix --help' for more information.
>
> Because of this, I couldn't do the test with television[3-4] that I wanted.
>

Right, it seems guix package might not be setting the search paths, but
it should have worked when adding to your home config.

> I tried 10 different searches, and this seems to have "issues"—more like
> warnings, as there's no crashes—with longer results:
>
>>$ make env
>>guix shell -m env/manifest.scm -- || exit 0	#ignore the shell’s return value
>>$$ guix xsearch kde
>>name: kde-games
>>[...]
>
> I then scroll to the third result, which in my case is kde-cli-tools, by
> pressing "PageDown" + "Up Arrow" to keep the "name" line at the top:
>
>>name: kde-cli-tools
>>[...]
>
> And press "q", to quit (I think that search uses the default pager,
> which in my case is still less):
>
>>Backtrace:
>>           9 (primitive-load "/home/gabriel/.config/guix/current/bin…")
>>In guix/ui.scm:
>>   2352:7  8 (run-guix . _)
>>  2315:10  7 (run-guix-command _ . _)
>>  1807:16  6 (call-with-paginated-output-port _ #:less-options _)
>>  1850:11  5 (_ #<output: #{write pipe}# 20>)
>>   1655:2  4 (package->recutils _ #<output: #{write pipe}# 20> _ # _ …)
>>In ice-9/format.scm:
>>  1548:18  3 (format #<output: #{write pipe}# 20> "~a~%" "descriptio…")
>>   216:11  2 (format:format-work "~a~%" ("description: `trayer' is …"))
>>     65:8  1 (format:out-obj-padded _ _ _ _)
>>In unknown file:
>>           0 (display "description: `trayer' is small program desig…" …)
>>
>>ERROR: In procedure display:
>>In procedure fport_write: Broken pipe
>
> This is only a issue if you stop at the middle of a search result. It
> doesn't happen when you press "END" for examplle to get to the very last
> one.
>

Good catch, I will fix this.

> With those issues aside, it seems realy good, the search seems to be almost
> instant.
>

Nice! I like your idea of trying it with television, although I wonder
what you plan to do?

The guix package command is not covered by guix-xsearch so you will have
to adapt the commands.  That said, you can probably make a script to go
through the database and list packages (could be slow or fast I don’t
know) and use guix xsearch title:<package> to find candidates.

Good luck!
Noé

> [1] <https://codeberg.org/gs-101/.files/commit/d8405ce168b67323e0de03e51c111ec75b127c5d>
> [2] <https://codeberg.org/gs-101/.files/commit/9d8a9d81a5aa5b5304997e714537df771d7725df>
> [3] <https://github.com/alexpasmantier/television>
> [4] <https://github.com/alexpasmantier/television/wiki/Cable-channels#%EF%B8%8F-guix>
>
> Regards,
>
> -- 
> Gabriel Santos