guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/04: ui: Bypass Texinfo parsing and rendering for searches.


From: guix-commits
Subject: 03/04: ui: Bypass Texinfo parsing and rendering for searches.
Date: Sat, 23 Mar 2019 19:14:06 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 94aeec0aef03ab44e41bfc3e77c3b623cb3d607c
Author: Ludovic Courtès <address@hidden>
Date:   Sat Mar 23 23:53:55 2019 +0100

    ui: Bypass Texinfo parsing and rendering for searches.
    
    This makes search queries such as:
    
      LANGUAGE=fr guix package -s utilitaire -s recherche
    
    about 6 times faster.
    
    * guix/ui.scm (%package-metrics): Do not use 'package-synopsis-string'
    and 'package-description-string' to bypass Texinfo parsing and
    rendering.
---
 guix/ui.scm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index 2fc001d..0070301 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1329,8 +1329,14 @@ score, the more relevant OBJ is to REGEXPS."
   ;; Metrics used to compute the "relevance score" of a package against a set
   ;; of regexps.
   `((,package-name . 4)
-    (,package-synopsis-string . 3)
-    (,package-description-string . 2)
+
+    ;; 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)
+        (and=> (package-synopsis package) P_)) . 3)
+    (,(lambda (package)
+        (and=> (package-description package) P_)) . 2)
+
     (,(lambda (type)
         (match (and=> (package-location type) location-file)
           ((? string? file) (basename file ".scm"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]