GNU bug report logs -
#58136
[PATCH] ui: Improve sort order when searching package names.
Previous Next
Reported by: Lars-Dominik Braun <lars <at> 6xq.net>
Date: Wed, 28 Sep 2022 09:28:02 UTC
Severity: normal
Tags: moreinfo, patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 58136 <at> debbugs.gnu.org (full text, mbox):
Hi Lars,
On Wed, 28 Sep 2022 at 11:27, Lars-Dominik Braun <lars <at> 6xq.net> wrote:
> I propose we also score the unprefixed package name, so SCORE can award
> bonus points for a full string match. I don’t like that we have to
> maintain a list of common prefixes for this and that package names are
> scored twice now, but I can’t think of a better solution right now.
In addition to your proposal which LGTM, maybe we could also use the
’upstream-name’ properties. Most of the time, the Guix name matches the
upstream name, but sometimes not. Although, it would not fix the issue
for ggplot2 since there is no upstream-name for this package. :-)
Well, I propose something like see below (based on your patch):
1. keep the weight as 4
2. set the “namespace” weight to 1 (or 2 if you prefer)
Otherwise, for example, generic name as CSV could artificially bump
the relevance and hide relevant packages. For instance, compare
guix search csv
3. use upstream-name if provided
WDYT?
--8<---------------cut here---------------start------------->8---
diff --git a/guix/ui.scm b/guix/ui.scm
index 55b596ed35..14f296a546 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1655,7 +1655,7 @@ (define (regexp->score regexp)
(define %package-metrics
;; Metrics used to compute the "relevance score" of a package against a set
;; of regexps.
- `((,package-name . 8)
+ `((,package-name . 4)
;; For packages with a language prefix (namespaces), also compare the
;; unprefixed name, so searching for “ggplot2” yields
@@ -1684,9 +1684,9 @@ (define %package-metrics
(if (string-prefix? prefix name)
(cons (substring name (string-length prefix)) accum)
accum))
- '()
+ (list (package-upstream-name package))
namespaces)))
- . 4)
+ . 1)
;; Match against uncommon outputs.
(,(lambda (package)
--8<---------------cut here---------------end--------------->8---
Cheers,
simon
This bug report was last modified 2 years and 161 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.