GNU bug report logs - #35588
guix package --search does not search output names

Previous Next

Package: guix;

Reported by: Chris Marusich <cmmarusich <at> gmail.com>

Date: Sun, 5 May 2019 19:40:01 UTC

Severity: normal

Tags: fixed

Done: Chris Marusich <cmmarusich <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Chris Marusich <cmmarusich <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>, swedebugia <swedebugia <at> riseup.net>
Cc: Tobias Geerinckx-Rice <me <at> tobias.gr>, 35588 <at> debbugs.gnu.org
Subject: bug#35588: [PATCH] ui: Search matches additional package outputs., bug#35588: [PATCH] ui: Search matches additional package outputs.
Date: Tue, 07 May 2019 23:50:29 -0700
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes:

>>               (match (field obj)
>>                 (#f  relevance)
>> -               (str (+ relevance
>> -                       (* (score str) weight)))))))
>> +               ((? string? str) (+ relevance
>> +                                   (* (score str) weight)))
>> +               ((? list? lst) (+ relevance
>> +                                 (* weight
>> +                                    (apply + (map score lst)))))))))
>
> Nitpick: it’s a bit subjective, but I think this clause might be
> slightly nicer like this:
>
>   ((lst ...)
>    (+ relevance (* weight (reduce + 0 (map score lst)))))

Works for me!  I've changed the match clause accordingly in the attached
patch.

swedebugia <swedebugia <at> riseup.net> writes:

> On 2019-05-07 02:57, Chris Marusich wrote:
>> +    ;; Match against uncommon outputs.
>> +    (,(lambda (package)
>> +        (filter (lambda (output)
>> +                  (not (member output
>> +                               ;; Some common outpus shared by many packages.
>> +                               '("out" "debug" "doc" "static"))))
>
> I suggest we add "gui" and "lib" to this list.

Actually, I was curious about this, so I checked how many outputs are
being used by all our packages today.  Here are the results:

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,use (gnu packages) (guix packages)
scheme@(guix-user)> (define (increment table key) (hash-set! table key (+ 1 (hash-ref table key 0))))
scheme@(guix-user)> (define (increment-outputs package table) (for-each (lambda (output) (increment table output)) (package-outputs package)) table)
scheme@(guix-user)> (define outputs-to-count (fold-packages increment-outputs (make-hash-table)))
scheme@(guix-user)> ,pp (sort (hash-map->list cons outputs-to-count) (lambda (a b) (< (cdr a) (cdr b))))
$1 = (("kernel-patch" . 1)
 ("pcf-8bit" . 1)
 ("python2" . 1)
 ("schema" . 1)
 ("octave" . 1)
 ("jp" . 1)
 ("db" . 1)
 ("gtk3" . 1)
 ("kr" . 1)
 ("subtree" . 1)
 ("pulseaudio" . 1)
 ("cn" . 1)
 ("ruby" . 1)
 ("fbgrab" . 1)
 ("credential-netrc" . 1)
 ("front-end" . 1)
 ("psf" . 1)
 ("tw" . 1)
 ("libedataserverui" . 1)
 ("gtk2" . 1)
 ("pcf" . 1)
 ("send-email" . 1)
 ("jack" . 1)
 ("python3" . 1)
 ("ndiff" . 1)
 ("installer" . 1)
 ("svn" . 1)
 ("image" . 1)
 ("tiles" . 2)
 ("fortran" . 3)
 ("include" . 3)
 ("utils" . 3)
 ("tests" . 3)
 ("python" . 4)
 ("tk" . 4)
 ("metis" . 4)
 ("gui" . 4)
 ("examples" . 5)
 ("jdk" . 6)
 ("bin" . 8)
 ("cargo" . 16)
 ("static" . 33)
 ("lib" . 38)
 ("debug" . 87)
 ("doc" . 134)
 ("out" . 9811))
scheme@(guix-user)> 
--8<---------------cut here---------------end--------------->8---

In light of that, I've chosen to exclude all of the following outputs:

  '("out" "doc" "debug" "lib" "static" "bin" "examples" "gui" "tests"
    "utils" "include")

I've also added a test to verify that package outputs are included in
search results.

What do you all think of this latest version?

-- 
Chris
[0001-ui-Make-package-outputs-searchable.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 6 years and 12 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.