ui: Add source file name to the package search metrics.

* guix/ui.scm (%package-metrics): Include 'package-location'.  Increase
score of the other fields.
This commit is contained in:
Ludovic Courtès 2017-11-15 17:38:21 +01:00
parent 589e3f4e70
commit 304a53f67a
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 8 additions and 3 deletions

View File

@ -1121,9 +1121,14 @@ score, the more relevant OBJ is to REGEXPS."
(define %package-metrics (define %package-metrics
;; Metrics used to compute the "relevance score" of a package against a set ;; Metrics used to compute the "relevance score" of a package against a set
;; of regexps. ;; of regexps.
`((,package-name . 3) `((,package-name . 4)
(,package-synopsis-string . 2) (,package-synopsis-string . 3)
(,package-description-string . 1))) (,package-description-string . 2)
(,(lambda (type)
(match (and=> (package-location type) location-file)
((? string? file) (basename file ".scm"))
(#f "")))
. 1)))
(define (package-relevance package regexps) (define (package-relevance package regexps)
"Return a score denoting the relevance of PACKAGE for REGEXPS. A score of "Return a score denoting the relevance of PACKAGE for REGEXPS. A score of