@@ -1655,7 +1655,38 @@ (define (regexp->score regexp)
(define %package-metrics
;; Metrics used to compute the "relevance score" of a package against a set
;; of regexps.
- `((,package-name . 4)
+ `((,package-name . 8)
+
+ ;; For packages with a language prefix (namespaces), also compare the
+ ;; unprefixed name, so searching for “ggplot2” yields
+ ;; r-ggplot2 as first result instead of other, higher-ranked packages,
+ ;; which contain “ggplot2” in their description alot.
+ (,(lambda (package)
+ (let ((namespaces (list "cl-"
+ "ecl-"
+ "emacs-"
+ "ghc-"
+ "go-"
+ "guile-"
+ "java-"
+ "julia-"
+ "node-"
+ "ocaml-"
+ "perl-"
+ "python-"
+ "r-"
+ "ruby-"
+ "rust-"
+ "sbcl-"
+ "texlive-"))
+ (name (package-name package)))
+ (fold (lambda (prefix accum)
+ (if (string-prefix? prefix name)
+ (cons (substring name (string-length prefix)) accum)
+ accum))
+ '()
+ namespaces)))
+ . 4)
;; Match against uncommon outputs.
(,(lambda (package)