From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 24 17:03:21 2020 Received: (at 39258) by debbugs.gnu.org; 24 Apr 2020 21:03:21 +0000 Received: from localhost ([127.0.0.1]:58086 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jS5Tk-0001EA-Kv for submit@debbugs.gnu.org; Fri, 24 Apr 2020 17:03:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jS5Tj-0001Dy-Bh for 39258@debbugs.gnu.org; Fri, 24 Apr 2020 17:03:19 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40313) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jS5Tc-0002SD-NZ; Fri, 24 Apr 2020 17:03:12 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=45874 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jS5Tb-0007TQ-Bs; Fri, 24 Apr 2020 17:03:12 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Arun Isaac Subject: Re: [bug#39258] [PATCH v3 3/3] guix: Use package metadata cache for package search. References: <20200327162654.18785-1-arunisaac@systemreboot.net> <20200327162654.18785-4-arunisaac@systemreboot.net> Date: Fri, 24 Apr 2020 23:03:10 +0200 In-Reply-To: <20200327162654.18785-4-arunisaac@systemreboot.net> (Arun Isaac's message of "Fri, 27 Mar 2020 21:56:54 +0530") Message-ID: <87v9lofvg1.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39258 Cc: mail@ambrevar.xyz, 39258@debbugs.gnu.org, zimon.toutoune@gmail.com 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.7 (-) Hello, Arun Isaac skribis: > * guix/scripts/package.scm (process-query): Call search-packages and > display-package-search-results instead of find-packages-by-description and > display-search-results respectively. > * guix/ui.scm (package-metadata->recutils): New function. > (%package-metrics): Use package-metadata record field accessors. > (package-relevance): Rename argument package to package-metadata. > (display-package-search-results): New function. [...] > +(define* (package-metadata->recutils p port #:optional (width (%text-wid= th)) > + #:key > + (hyperlinks? (supports-hyperlinks? = port)) > + (extra-fields '())) > + "Write to PORT a `recutils' record of object P, arr= anging > +to fit within WIDTH columns. EXTRA-FIELDS is a list of symbol/value pai= rs to > +emit. When HYPERLINKS? is true, emit hyperlink escape sequences when > +appropriate." I think we should avoid copy/paste of =E2=80=98package->recutils=E2=80=99. How about factorizing by having a common procedure that takes the fields as keyword arguments instead of taking a record? > (define %package-metrics > ;; Metrics used to compute the "relevance score" of a package against = a set > ;; of regexps. > - `((,package-name . 4) > + `((,package-metadata-name . 4) Here we would also need to arrange so that this can apply to both a and (or whatever), perhaps by defining the two sets of metrics at once, or defining the second one by mapping over the first one. Thanks, Ludo=E2=80=99.