From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:43750) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jS5US-0006cT-HT for guix-patches@gnu.org; Fri, 24 Apr 2020 17:04:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jS5UR-0002aO-3q for guix-patches@gnu.org; Fri, 24 Apr 2020 17:04:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46540) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jS5UQ-0002aJ-ON for guix-patches@gnu.org; Fri, 24 Apr 2020 17:04:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jS5UQ-0001FD-In for guix-patches@gnu.org; Fri, 24 Apr 2020 17:04:02 -0400 Subject: [bug#39258] [PATCH v3 3/3] guix: Use package metadata cache for package search. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Arun Isaac Cc: mail@ambrevar.xyz, 39258@debbugs.gnu.org, zimon.toutoune@gmail.com 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.