[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#39258] [PATCH 4/4] gnu: Use xapian index for package search.
From: |
Pierre Neidhardt |
Subject: |
[bug#39258] [PATCH 4/4] gnu: Use xapian index for package search. |
Date: |
Fri, 28 Feb 2020 09:11:31 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Arun Isaac <address@hidden> writes:
> @@ -453,6 +454,20 @@ reducing the memory footprint."
>
> db-path)
>
> +(define (search-package-index profile querystring)
Maybe `query-string'?
>
> --- a/guix/scripts/package.scm
> +++ b/guix/scripts/package.scm
> @@ -7,6 +7,7 @@
> ;;; Copyright © 2016 Benz Schenk <address@hidden>
> ;;; Copyright © 2016 Chris Marusich <address@hidden>
> ;;; Copyright © 2019 Tobias Geerinckx-Rice <address@hidden>
> +;;; Copyright © 2020 Arun Isaac <address@hidden>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -178,31 +179,40 @@ hooks\" run when building the profile."
> ;;; Package specifications.
> ;;;
>
> -(define (find-packages-by-description regexps)
> +(define (find-packages-by-description patterns)
> "Return a list of pairs: packages whose name, synopsis, description,
> or output matches at least one of REGEXPS sorted by relevance, and its
> non-zero relevance score."
Need to update the docstring.
> - (let ((matches (fold-packages (lambda (package result)
> - (if (package-superseded package)
> - result
> - (match (package-relevance package
> - regexps)
> - ((? zero?)
> - result)
> - (score
> - (cons (cons package score)
> - result)))))
> - '())))
> - (sort matches
> - (lambda (m1 m2)
> - (match m1
> - ((package1 . score1)
> - (match m2
> - ((package2 . score2)
> - (if (= score1 score2)
> - (string>? (package-full-name package1)
> - (package-full-name package2))
> - (> score1 score2))))))))))
> + (define (regexp? str)
> + (string-any
> + (char-set #\. #\[ #\{ #\} #\( #\) #\\ #\* #\+ #\? #\| #\^ #\$)
> + str))
> +
> + (if (and (current-profile)
> + (not (any regexp? patterns)))
I would not put characters like ".", "$", or "+" here, lest we mistake a
Xapian pattern for a regexp.
As you said, I don't think both are compatible without ambiguity
anyways, so we should probably drop regexp (or at least toggle them with
a command line argument).
--
Pierre Neidhardt
https://ambrevar.xyz/
signature.asc
Description: PGP signature
- [bug#39258] [PATCH 0/4] Xapian for Guix package search, Arun Isaac, 2020/02/27
- [bug#39258] [PATCH 3/4] gnu: Generate xapian package search index., Arun Isaac, 2020/02/27
- [bug#39258] [PATCH 1/4] gnu: Add guile-xapian., Arun Isaac, 2020/02/27
- [bug#39258] [PATCH 4/4] gnu: Use xapian index for package search., Arun Isaac, 2020/02/27
- [bug#39258] [PATCH 4/4] gnu: Use xapian index for package search.,
Pierre Neidhardt <=
- [bug#39258] [PATCH 2/4] build-self: Add guile-xapian to Guix dependencies., Arun Isaac, 2020/02/27
- [bug#39258] [PATCH 0/4] Xapian for Guix package search, Pierre Neidhardt, 2020/02/28
- [bug#39258] [PATCH 0/4] Xapian for Guix package search, zimoun, 2020/02/28