GNU bug report logs -
#39258
Faster guix search using an sqlite cache
Previous Next
Full log
Message #229 received at 39258 <at> debbugs.gnu.org (full text, mbox):
Arun Isaac <arunisaac <at> systemreboot.net> skribis:
> * gnu/packages.scm (search-packages): New function.
> * guix/packages.scm (<package-metadata>): New record type.
[...]
> +(define (search-packages profile regexps)
> + "Return a list of pairs: <package-metadata> objects corresponding to
> +packages whose name, synopsis, description, or output matches at least one of
> +REGEXPS sorted by relevance, and its non-zero relevance score."
> + (define cache-file
> + (string-append profile %package-metadata-cache-file))
Here we’re missing something that checks if the cache is authoritative
and falls back to the old method if it’s not, akin to what
‘fold-available-packages’ does.
> + (define cache
> + (catch 'system-error
> + (lambda ()
> + (map (match-lambda
> + (#(name version dependencies outputs systems
> + synopsis description home-page (file line column))
> + (make-package-metadata
> + name version dependencies outputs systems
> + synopsis description home-page
> + (location file line column))))
> + (load-compiled cache-file)))
I realize the other cache also has that problem, but it would be nice to
add a version tag to the cache. Basically emit something like:
(package-metadata-cache (version 0) VECTOR …)
instead of just:
(VECTOR …)
> +(define-record-type* <package-metadata>
> + package-metadata make-package-metadata
> + package-metadata?
> + this-package-metadata
> + (name package-metadata-name)
> + (version package-metadata-version)
> + (dependencies package-metadata-dependencies)
> + (outputs package-metadata-outputs)
> + (supported-systems package-metadata-supported-systems)
> + (synopsis package-metadata-synopsis)
> + (description package-metadata-description)
> + ;; TODO: Add license
> + ;; (license package-metadata-license)
> + (home-page package-metadata-home-page)
> + (location package-metadata-location))
I’m not comfortable with this data structure duplication, especially
right in (guix packages, but I’m not sure it’s avoidable.
‘fold-available-packages’ avoids it by passing all the fields as
arguments to the fold procedure, I’m not sure if it’s applicable here.
Thanks,
Ludo’.
This bug report was last modified 38 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.