unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* `guix search` feature or bug?
@ 2019-07-17 13:40 zimoun
  2019-07-17 21:31 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: zimoun @ 2019-07-17 13:40 UTC (permalink / raw)
  To: Guix Devel

Dear,

An example describes better than words. :-)

  guix package --show=tuxpaint

And one can read the terms `software` in the synopsis and `tools` in
the description.
However, `guix search software tools` does not output the package `tuxpaint`.

  guix search software tools | recsel -C -P name | sort

From the function `relevance` in `guix/ui.scm`, if I understand well,
it seems expected. Each field deals with the regexp and the terms
`software` and `tools` does not appear both in only one field.

Is this behaviour expected?


To be more concrete, the manual says "And now for a more elaborate
example.  The following command searches for cryptographic libraries,
filters out Haskell, Perl, Python, and Ruby libraries, and prints the
name and synopsis of the matching packages:

   $ guix search crypto library | \
        recsel -e '! (name ~ "^(ghc|perl|python|ruby)")' -p name,synopsis
"

and the cryptographic library `libb2` is not listed by the previous
search command line because the terms `crypto` and `library` does not
appear both in the same field.

    guix package --show=libb2

name: libb2
version: 0.98.1
outputs: out
systems: x86_64-linux i686-linux armhf-linux aarch64-linux mips64el-linux
dependencies:
location: gnu/packages/crypto.scm:648:2
homepage: https://blake2.net/
license: Public Domain
synopsis: Library implementing the BLAKE2 family of hash functions
description: libb2 is a portable implementation of the BLAKE2 family of
+ cryptographic hash functions.  It includes optimised implementations for IA-32
+ and AMD64 processors, and an interface layer that automatically selects the
+ best implementation for the processor it is run on.
+
+ "BLAKE2" (RFC 7693) is a family of high-speed cryptographic hash functions
+ that are faster than MD5, SHA-1, SHA-2, and SHA-3, yet are at least as secure
+ as the latest standard, SHA-3.  It is an improved version of the SHA-3
+ finalist BLAKE.



All the best,
simon

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

* Re: `guix search` feature or bug?
  2019-07-17 13:40 `guix search` feature or bug? zimoun
@ 2019-07-17 21:31 ` Ludovic Courtès
  2019-07-18 14:59   ` zimoun
  2019-07-22 17:20   ` zimoun
  0 siblings, 2 replies; 4+ messages in thread
From: Ludovic Courtès @ 2019-07-17 21:31 UTC (permalink / raw)
  To: zimoun; +Cc: Guix Devel

Hi,

zimoun <zimon.toutoune@gmail.com> skribis:

> An example describes better than words. :-)
>
>   guix package --show=tuxpaint
>
> And one can read the terms `software` in the synopsis and `tools` in
> the description.
> However, `guix search software tools` does not output the package `tuxpaint`.
>
>   guix search software tools | recsel -C -P name | sort
>
> From the function `relevance` in `guix/ui.scm`, if I understand well,
> it seems expected. Each field deals with the regexp and the terms
> `software` and `tools` does not appear both in only one field.
>
> Is this behaviour expected?

Not really!  It’s the result of commit
8874faaaac665100a095ef25e39c9a389f5a397f, but I agree that what you
expected would be nicer.  We should fix it.

Do you want to give it a try?  :-)

Thanks,
Ludo’.

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

* Re: `guix search` feature or bug?
  2019-07-17 21:31 ` Ludovic Courtès
@ 2019-07-18 14:59   ` zimoun
  2019-07-22 17:20   ` zimoun
  1 sibling, 0 replies; 4+ messages in thread
From: zimoun @ 2019-07-18 14:59 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix Devel

Hi,

On Wed, 17 Jul 2019 at 23:31, Ludovic Courtès <ludo@gnu.org> wrote:

> zimoun <zimon.toutoune@gmail.com> skribis:

> > From the function `relevance` in `guix/ui.scm`, if I understand well,
> > it seems expected. Each field deals with the regexp and the terms
> > `software` and `tools` does not appear both in only one field.
> >
> > Is this behaviour expected?
>
> Not really!  It’s the result of commit
> 8874faaaac665100a095ef25e39c9a389f5a397f, but I agree that what you
> expected would be nicer.  We should fix it.

Thank you for pointing the commit. I am always impressed how Guix is
powerful, awesome!
I mean, to try the previous behavior (regexps connected with logical
*OR*), I just need to run:

  guix pull --commit=c25b44d640 -p old-guix
  ./old-guix/bin/guix search crypto library |  recsel -e '! (name ~
"^(ghc|perl|python|ruby)")' -C -R name,relevance

which outputs non cryptographic libraries. Ouch!


From my point of view, there is 2 issues:
 1. the pure search
 2. the scoring (see the other thread [1] ;-))

The easy fix for the pure search is to simply use `recsel` ;-)
The correct command line of the example from the manual is:

guix search " " \
    | recsel -e '! (name ~ "^(ghc|perl|python|ruby)")' \
    | recsel -e \
 '((synopsis ~ "[L|l]ibrary") || (description ~ "[L|l]ibrary")) &&
((synopsis ~ "[C|c]rypto") || (description ~ "[C|c]rypto"))' \
             -C -P name | sort


IMO, a better UI should be to not use `recsel` at all. :-)
Something in this flavour:

guix search library crypto '!(%n ~ "^(ghc|perl|python|ruby)")' --pretty="%S %n"

Well, as previously mentioned [2] ;-)

What do you think?
Do it appear to you a good idea to integrate in `guix search` more
(regexp) filtering and output options?


[1] https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00270.html
[2] https://lists.gnu.org/archive/html/guix-devel/2018-12/msg00480.html


> Do you want to give it a try?  :-)

I do not know if I have enough Scheme skills to fix the inter-field
logical *AND*.
Let see, I will give it a try. :-)
Or maybe someone will be faster than me ;-)
(summer holidays soon...)


All the best,
simon

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

* Re: `guix search` feature or bug?
  2019-07-17 21:31 ` Ludovic Courtès
  2019-07-18 14:59   ` zimoun
@ 2019-07-22 17:20   ` zimoun
  1 sibling, 0 replies; 4+ messages in thread
From: zimoun @ 2019-07-22 17:20 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix Devel

Hi,

On Wed, 17 Jul 2019 at 23:31, Ludovic Courtès <ludo@gnu.org> wrote:

> Do you want to give it a try?  :-)

I have tried. :-)
The result is there [1].
Please heavy comment! ;-)


All the best,
simon

[1] https://lists.gnu.org/archive/html/bug-guix/2019-07/msg00301.html

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

end of thread, other threads:[~2019-07-22 17:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-17 13:40 `guix search` feature or bug? zimoun
2019-07-17 21:31 ` Ludovic Courtès
2019-07-18 14:59   ` zimoun
2019-07-22 17:20   ` zimoun

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).