From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 28 10:42:44 2022 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 To: Lars-Dominik Braun , 58136@debbugs.gnu.org Subject: Re: [bug#58136] [PATCH] ui: Improve sort order when searching package names. In-Reply-To: References: 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-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 58136 Cc: ludo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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=E2=80=99t like that we have to > maintain a list of common prefixes for this and that package names are > scored twice now, but I can=E2=80=99t think of a better solution right no= w. In addition to your proposal which LGTM, maybe we could also use the =E2=80=99upstream-name=E2=80=99 properties. Most of the time, the Guix nam= e 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 =E2=80=9Cnamespace=E2=80=9D 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) =20 ;; For packages with a language prefix (namespaces), also compare the ;; unprefixed name, so searching for =E2=80=9Cggplot2=E2=80=9D 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) =20 ;; Match against uncommon outputs. (,(lambda (package) --8<---------------cut here---------------end--------------->8--- Cheers, simon