aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages.scm17
1 files changed, 16 insertions, 1 deletions
diff --git a/gnu/packages.scm b/gnu/packages.scm
index e91753e2a8..5b5b29bf84 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -67,7 +67,8 @@
specifications->manifest
generate-package-cache
- generate-package-search-index))
+ generate-package-search-index
+ search-package-index))
;;; Commentary:
;;;
@@ -453,6 +454,20 @@ reducing the memory footprint."
db-path)
+(define (search-package-index profile querystring)
+ (let ((offset 0)
+ (pagesize 10))
+ (call-with-database (string-append profile %package-search-index)
+ (lambda (db)
+ (let ((query (parse-query querystring #:stemmer (make-stem "en"))))
+ (mset-fold (lambda (item result)
+ (match (find-packages-by-name
+ (document-data (mset-item-document item)))
+ ((package _ ...)
+ (append result `((,package . ,(mset-item-weight item)))))))
+ '()
+ (enquire-mset (enquire db query) offset pagesize)))))))
+
(define %sigint-prompt
;; The prompt to jump to upon SIGINT.