Message ID | 86wn9na82p.fsf@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4355D27BBEB; Wed, 28 Sep 2022 16:58:54 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E6A2B27BBEA for <patchwork@mira.cbaines.net>; Wed, 28 Sep 2022 16:58:53 +0100 (BST) Received: from localhost ([::1]:43266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org>) id 1odZSW-0002d9-MI for patchwork@mira.cbaines.net; Wed, 28 Sep 2022 11:58:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1odYH8-0007A7-Pz for guix-patches@gnu.org; Wed, 28 Sep 2022 10:43:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35047) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1odYH8-0006tB-E5 for guix-patches@gnu.org; Wed, 28 Sep 2022 10:43:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1odYH8-00087I-3P for guix-patches@gnu.org; Wed, 28 Sep 2022 10:43:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58136] [PATCH] ui: Improve sort order when searching package names. Resent-From: zimoun <zimon.toutoune@gmail.com> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 28 Sep 2022 14:43:02 +0000 Resent-Message-ID: <handler.58136.B58136.166437616431173@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58136 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Lars-Dominik Braun <lars@6xq.net>, 58136@debbugs.gnu.org Cc: ludo@gnu.org Received: via spool by 58136-submit@debbugs.gnu.org id=B58136.166437616431173 (code B ref 58136); Wed, 28 Sep 2022 14:43:02 +0000 Received: (at 58136) by debbugs.gnu.org; 28 Sep 2022 14:42:44 +0000 Received: from localhost ([127.0.0.1]:34125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1odYGp-00086g-QB for submit@debbugs.gnu.org; Wed, 28 Sep 2022 10:42:44 -0400 Received: from mail-wm1-f54.google.com ([209.85.128.54]:40479) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <zimon.toutoune@gmail.com>) id 1odYGn-00086T-87 for 58136@debbugs.gnu.org; Wed, 28 Sep 2022 10:42:42 -0400 Received: by mail-wm1-f54.google.com with SMTP id u16-20020a05600c211000b003b5152ebf09so1390739wml.5 for <58136@debbugs.gnu.org>; Wed, 28 Sep 2022 07:42:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date; bh=a5R2Y6idmqUJB43TeXLZv1Jv2eAXN72xx+BfH3GmMJ8=; b=Dmgfl8NFYwgkQbCcDxAc8qTS/gywdhkz76ue5hOvtB/Rl/WaImoEELzMGX2ORzKBEJ tjrmlslG4BLsQH1O5bX/vtBDo5PnCm8id4W+r5XEyoG8QVfBo1zNudUEDD27e2MrieFy lQAM9OLvKl0ntLMbcRnmniWRk5hBOM9a0lGB1cU/0Qba3B4uGP6GKao0SgCm3sHgrftI cJNfFLEBddcP3Ib6uzc2XPkAhS+WlnBQ4xWqUNy4RpTXtFZTLDiikU+YvEcO6gM8AqCm 3Ay+qyS56o/N5sk1Kg3J99nYVZlADLAR3hMPdcy+Y2k1LiMNCnCyKQogVqAl5LlRlCdF rJ7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=a5R2Y6idmqUJB43TeXLZv1Jv2eAXN72xx+BfH3GmMJ8=; b=G5eG5k541OTCMdUflKsxow3vRDocwSAWNnB8qpLWXapH6d79Qs4Tj0LUMSFjw8Pqw1 vBiRT712Bef8XcGDpn1vFYFyG9NIYyxwYtiYlV3LDVs2OriJ17khr3hc8gUJEMF6vHA9 bKb4pveBovX2S19LR/HzgOD1WiVd7Ek+zJGIsDZh7ssutU5wjVsbcLbQcsBDmDYkaWtX kDFPW5NxMAoyJa6BG7jb/dV4KC7443fDos2UO0HcosFIhUuffNYicLff1yV7eNqmO1Tj NBS6Q023q7nFn8fFpm1Igsduabob7pETzwAxWLTULflRKXtjGYrHM2WQdiRJClYKVFk/ FXRw== X-Gm-Message-State: ACrzQf15ZWaEuw64KF/XqczgLJIbi/7+O+SbRxbFLaod/Plpbl8ahodP xZbW27bAt68tj5iy7C4fNOc= X-Google-Smtp-Source: AMsMyM5y5g+RUcvPX9DKGx/5TnzOETZh2o+t0kYDGGVC0YlGzC3UMlaosWwMK8x3n77djiK2gnCEDw== X-Received: by 2002:a05:600c:1c03:b0:3b4:618b:5d14 with SMTP id j3-20020a05600c1c0300b003b4618b5d14mr6857540wms.59.1664376155171; Wed, 28 Sep 2022 07:42:35 -0700 (PDT) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id iv16-20020a05600c549000b003b4c40378casm2096979wmb.39.2022.09.28.07.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 07:42:34 -0700 (PDT) From: zimoun <zimon.toutoune@gmail.com> In-Reply-To: <YzQTieJZSCJGTGY2@noor.fritz.box> References: <YzQTieJZSCJGTGY2@noor.fritz.box> Date: Wed, 28 Sep 2022 16:26:38 +0200 Message-ID: <86wn9na82p.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-getmail-retrieved-from-mailbox: Patches |
Series |
[bug#58136] ui: Improve sort order when searching package names.
|
|
Commit Message
Simon Tournier
Sept. 28, 2022, 2:26 p.m. UTC
Hi Lars, On Wed, 28 Sep 2022 at 11:27, Lars-Dominik Braun <lars@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--- --8<---------------cut here---------------end--------------->8--- Cheers, simon
Comments
> + ;; For packages with a language prefix (namespaces), also compare the You missed "minetest-" On 28-09-2022 16:26, zimoun wrote: > 3. use upstream-name if provided > > WDYT? For the Minetest mods (which have upstream-names like "Jeija/mesecons"), I don't think think the upstream-name is useful as-is Greetings, Maxime.
On 28-09-2022 22:23, Maxime Devos wrote:
> You missed "minetest-"
Also, "lua-".
Hi, On mer., 28 sept. 2022 at 22:23, Maxime Devos <maximedevos@telenet.be> wrote: > On 28-09-2022 16:26, zimoun wrote: >> 3. use upstream-name if provided > > For the Minetest mods (which have upstream-names like "Jeija/mesecons"), > I don't think think the upstream-name is useful as-is Using the change I am proposing, just knowing ’jeija’ returns a match: --8<---------------cut here---------------start------------->8--- $ ./pre-inst-env guix search jeija name: minetest-mesecons version: 1.2.1-63.27c3c51 outputs: + out: everything else systems: x86_64-linux dependencies: location: gnu/packages/minetest.scm:367:4 homepage: https://mesecons.net license: LGPL 3, CC-BY-SA 3.0 synopsis: Digital circuitry for Minetest, including wires, buttons and lights description: Mesecons is a mod for Minetest implementing various items + related to digital circuitry, such as wires, buttons, lights and programmable + controllers. Among other things, there are also pistons, solar panels, + pressure plates and note blocks. + + Mesecons has a similar goal to Redstone in Minecraft, but works in its own + way, with different rules and mechanics. relevance: 4 --8<---------------cut here---------------end--------------->8--- which is better than nothing. Well, upstream-name is not so much useful as-is but it can help for some cases. Cheers, simon
On 28-09-2022 23:40, zimoun wrote: > Using the change I am proposing, just knowing ’jeija’ returns a match: > > --8<---------------cut here---------------start------------->8--- > $ ./pre-inst-env guix search jeija > name: minetest-mesecons > [...] Right, didn't think of that. Greetings, Maxime.
Hi, zimoun <zimon.toutoune@gmail.com> skribis: > 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 Maybe something like: (define %package-metrics `((,package-name . 4) (,package-upstream-name* . 4) ;or a lower weight, dunno …)) where: (define (package-upstream-name* package) (or (assoc-ref (package-properties package) 'upstream-name) (package-name-sans-namespace package))) ;strip "r-", "emacs-", etc. WDYT? (Perhaps ‘package-upstream-name’ could be taught about these implicit name conversions done for R, Python, Emacs, etc.?) Ludo’.
Hi, On Sat, 01 Oct 2022 at 23:42, Ludovic Courtès <ludo@gnu.org> wrote: > (define (package-upstream-name* package) > (or (assoc-ref (package-properties package) 'upstream-name) > (package-name-sans-namespace package))) ;strip "r-", "emacs-", etc. I think it is better to rely on ’package-upstream-name’ and hides the plumbing. It helps when something needs to be “refactored“, IMHO. > (Perhaps ‘package-upstream-name’ could be taught about these implicit > name conversions done for R, Python, Emacs, etc.?) Maybe, but it requires to scrutinize importer per importer since upstream name is mainly used by these, IIUC. Cheers, simon
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)