[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#35588: [PATCH] ui: Search matches additional package outputs., bug#3
From: |
Chris Marusich |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Ludovic Courtès <address@hidden> 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 <address@hidden> 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
Description: Text Data
signature.asc
Description: PGP signature
- bug#35588: guix package --search does not search output names, Chris Marusich, 2019/05/05
- bug#35588: [PATCH] ui: Search matches additional package outputs., Tobias Geerinckx-Rice, 2019/05/05
- bug#35588: [PATCH] ui: Search matches additional package outputs., Chris Marusich, 2019/05/06
- bug#35588: [PATCH] ui: Search matches additional package outputs., Ludovic Courtès, 2019/05/06
- bug#35588: [PATCH] ui: Search matches additional package outputs., Chris Marusich, 2019/05/06
- bug#35588: [PATCH] ui: Search matches additional package outputs., Ludovic Courtès, 2019/05/07
- bug#35588: [PATCH] ui: Search matches additional package outputs., bug#35588: [PATCH] ui: Search matches additional package outputs.,
Chris Marusich <=
- bug#35588: [PATCH] ui: Search matches additional package outputs., bug#35588: [PATCH] ui: Search matches additional package outputs., Ludovic Courtès, 2019/05/08
- bug#35588: [PATCH] ui: Search matches additional package outputs., Chris Marusich, 2019/05/09
- bug#35588: [PATCH] ui: Search matches additional package outputs., swedebugia, 2019/05/07