From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id +BeHLDlvNGOYQAEAbAwnHQ (envelope-from ) for ; Wed, 28 Sep 2022 17:58:49 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id cNOjLDlvNGNsjgAA9RJhRA (envelope-from ) for ; Wed, 28 Sep 2022 17:58:49 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 63B733F1B2 for ; Wed, 28 Sep 2022 17:58:49 +0200 (CEST) Received: from localhost ([::1]:43266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odZSR-0002d9-OZ for larch@yhetil.org; Wed, 28 Sep 2022 11:58:47 -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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664380729; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=a5R2Y6idmqUJB43TeXLZv1Jv2eAXN72xx+BfH3GmMJ8=; b=UnaW88jCD7AyEOUjrCp0bRq2iaIuQys+FThEPUS13GhvGndjti9DvM5fZlAhLtVG9DoJFz 5xnRfzTu+ms5lTpw+WN19S0qUFm8zPUjjXgREC2d3ayj2Uc3JFH+GcYQ7RIwNCeaqfJhXp 3Dp9WBLdHJGZyDIGHTdmK7Qs5WCYa0tLU7OSLfC/TvSweWmXj1oea6DIAxMw70suafsvNS bzpNOUbqHCpz14lzu7z6+nWQ0T86YEhV5ED5LSiRty5kGB2/7W3eS1IEAczunFXHwADcaL uBUbmjVaJlraJdZ7vACG/2Ja9PrkpB1+jNucjvNxP3F0uavKAGfPZHN3c7B7VQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664380729; a=rsa-sha256; cv=none; b=Pd7Q5tSgKEq2t0N0eKwcroO1b0fvLHgHPBPU15ZEc6hljrqMbZTDpRMLYwPRBxHFTrByWY Dl9znTzqIbPPUBfnZcyKTvYPBJ4JQkxZUCZ0Uzw7VUGd36bs9O1Xg1IRXPRSBhYewPJprI zGh6SH1bWqOyNXKwFMAxfSh8h6VCx2VT9oiqIk0oKHYDvY2pBuRSAQYtGzjgN6teLz16sr hHCJO9FtI+kPqpCampYgYGyaGU5spCUuuYqsmJeteU/kJZquiebjDndmXKfdbMUcNGVc3/ hfpGdnKhepEzv0tZG5+fA4nutjfA+LeGFwkKfrE5FiIzgk83f0gksc5XGs833A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Dmgfl8NF; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 6.15 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Dmgfl8NF; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 63B733F1B2 X-Spam-Score: 6.15 X-Migadu-Scanner: scn1.migadu.com X-TUID: UNcqrLkBdvTa 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