From mboxrd@z Thu Jan 1 00:00:00 1970 From: zimoun Subject: Re: `guix search` feature or bug? Date: Thu, 18 Jul 2019 16:59:45 +0200 Message-ID: References: <87y30w73h2.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:38656) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ho7t4-0005iH-58 for guix-devel@gnu.org; Thu, 18 Jul 2019 11:00:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ho7t2-000752-SR for guix-devel@gnu.org; Thu, 18 Jul 2019 11:00:02 -0400 In-Reply-To: <87y30w73h2.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: =?UTF-8?Q?Ludovic_Court=C3=A8s?= Cc: Guix Devel Hi, On Wed, 17 Jul 2019 at 23:31, Ludovic Court=C3=A8s wrote: > zimoun 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=E2=80=99s 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=3Dc25b44d640 -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=3D"= %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