From patchwork Wed Sep 28 14:26:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 43026 Return-Path: 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 ; 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 ) 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 ) 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 ) 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 ) 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 Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 28 Sep 2022 14:43:02 +0000 Resent-Message-ID: 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 , 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 ) 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 ) 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 In-Reply-To: References: Date: Wed, 28 Sep 2022 16:26:38 +0200 Message-ID: <86wn9na82p.fsf@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Hi Lars, On Wed, 28 Sep 2022 at 11:27, Lars-Dominik Braun 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 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)