From: Tobias Geerinckx-Rice <me@tobias.gr>
To: 35588@debbugs.gnu.org
Subject: bug#35588: [PATCH] ui: Search matches additional package outputs.
Date: Sun, 5 May 2019 23:41:53 +0200 [thread overview]
Message-ID: <20190505214153.32372-1-me@tobias.gr> (raw)
In-Reply-To: <87r29czo6e.fsf@gmail.com>
* guix/ui.scm (%package-metrics): Add a PACKAGE-OUTPUTS metric with a
relevance of 1.
* guix/scripts/package.scm (process-query)<search>: Add the
REGEXP/NEWLINE flag.
---
mikadoZero, Guix,
Here's a patch to match package outputs (except ‘out’, since it can't affect the relative score) in ‘guix search’.
Before:
~ λ guix search ernel-patch
# nothing
After:
~ λ guix search ernel-patch
name: wireguard
version: 0.0.20190406
outputs: out kernel-patch
…
~ λ guix search ^ernel-patch
# nothing
While the new REGEXP/NEWLINE flag affects how all fields are matched, I don't think it actually changes anything in practice without the second hunk.
If there's a possibility that it might, I'd split this into two commits.
Kind regards,
T G-R
guix/scripts/package.scm | 3 ++-
guix/ui.scm | 6 ++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index aa27984ea2..a31e78484e 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -751,7 +751,8 @@ processed, #f otherwise."
(('query 'search rx) rx)
(_ #f))
opts))
- (regexps (map (cut make-regexp* <> regexp/icase) patterns)))
+ (regexps (map (cut make-regexp* <> regexp/icase regexp/newline)
+ patterns)))
(leave-on-EPIPE
(let-values (((packages scores)
(find-packages-by-description regexps)))
diff --git a/guix/ui.scm b/guix/ui.scm
index 92c845e944..f2466b605b 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1404,6 +1404,12 @@ score, the more relevant OBJ is to REGEXPS."
;; of regexps.
`((,package-name . 4)
+ ;; Separate package outputs by newlines to match regexps like "^tools$".
+ ;; Hard-codedly ignore ‘out’ since it presumably exists for every package.
+ (,(lambda (package)
+ (string-join (delete "out" (package-outputs package))
+ "\n")) . 1)
+
;; Match regexps on the raw Texinfo since formatting it is quite expensive
;; and doesn't have much of an effect on search results.
(,(lambda (package)
--
2.21.0
next prev parent reply other threads:[~2019-05-05 21:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-05 19:39 bug#35588: guix package --search does not search output names Chris Marusich
2019-05-05 21:41 ` Tobias Geerinckx-Rice [this message]
2019-05-06 9:08 ` bug#35588: [PATCH] ui: Search matches additional package outputs Chris Marusich
2019-05-06 9:32 ` Ludovic Courtès
2019-05-07 0:57 ` Chris Marusich
2019-05-07 8:25 ` Ludovic Courtès
2019-05-08 6:50 ` bug#35588: [PATCH] ui: Search matches additional package outputs., " Chris Marusich
2019-05-08 10:39 ` Ludovic Courtès
2019-05-09 7:22 ` Chris Marusich
2019-05-07 22:24 ` swedebugia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190505214153.32372-1-me@tobias.gr \
--to=me@tobias.gr \
--cc=35588@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.