GNU bug report logs - #39258
Faster guix search using an sqlite cache

Previous Next

Package: guix-patches;

Reported by: Arun Isaac <arunisaac <at> systemreboot.net>

Date: Thu, 23 Jan 2020 19:53:02 UTC

Severity: important

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: mail <at> ambrevar.xyz, 39258 <at> debbugs.gnu.org, zimon.toutoune <at> gmail.com
Subject: [bug#39258] [PATCH v3 3/3] guix: Use package metadata cache for package search.
Date: Fri, 24 Apr 2020 23:03:10 +0200
Hello,

Arun Isaac <arunisaac <at> systemreboot.net> 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-width))
> +                                     #:key
> +                                     (hyperlinks? (supports-hyperlinks? port))
> +                                     (extra-fields '()))
> +  "Write to PORT a `recutils' record of <package-metadata> object P, arranging
> +to fit within WIDTH columns.  EXTRA-FIELDS is a list of symbol/value pairs to
> +emit.  When HYPERLINKS? is true, emit hyperlink escape sequences when
> +appropriate."

I think we should avoid copy/paste of ‘package->recutils’.

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
<package> and <package-metadata> (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’.




This bug report was last modified 37 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.