diff options
author | Ludovic Courtès <ludo@gnu.org> | 2017-11-15 17:38:21 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2017-11-16 08:45:15 +0100 |
commit | 304a53f67aa4970dec98586e74c45487b0cd68ae (patch) | |
tree | ae41fd22760f755e7c99982eb5599c593fc87159 | |
parent | 589e3f4e709f35432c522e7c48ddd67c26a0306b (diff) |
ui: Add source file name to the package search metrics.
* guix/ui.scm (%package-metrics): Include 'package-location'. Increase
score of the other fields.
-rw-r--r-- | guix/ui.scm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/guix/ui.scm b/guix/ui.scm index 05782a537e..0fc5ab63ad 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -1121,9 +1121,14 @@ score, the more relevant OBJ is to REGEXPS." (define %package-metrics ;; Metrics used to compute the "relevance score" of a package against a set ;; of regexps. - `((,package-name . 3) - (,package-synopsis-string . 2) - (,package-description-string . 1))) + `((,package-name . 4) + (,package-synopsis-string . 3) + (,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) "Return a score denoting the relevance of PACKAGE for REGEXPS. A score of |