xapian: Include owner, severity, tag, and status in Xapian db.
authorRicardo Wurmus <rekado@elephly.net>
Wed, 13 May 2020 09:05:49 +0000 (11:05 +0200)
committerRicardo Wurmus <rekado@elephly.net>
Wed, 13 May 2020 09:52:29 +0000 (11:52 +0200)
mumi/xapian.scm

index 53737de7880c20946a308b9fc0ae0e7529b60ada..e4fd316f47c3da64ce9944bbe2639c2ecd2a57b2 100644 (file)
@@ -92,6 +92,7 @@ messages and index their contents in the Xapian database at DBPATH."
                                      (map email-body emails))
                                 "\n"))
 
+                  (bug (bug-status bugid))
                   (idterm (string-append "Q" bugid))
                   (doc (make-document #:data bugid
                                       #:terms `((,idterm . 0))
@@ -107,6 +108,12 @@ messages and index their contents in the Xapian database at DBPATH."
              (index-text! term-generator submitter #:prefix "A")
              (index-text! term-generator authors #:prefix "XA")
              (index-text! term-generator subjects #:prefix "S")
+             (index-text! term-generator (or (bug-owner bug) "") #:prefix "XO")
+             (index-text! term-generator (or (bug-severity bug) "normal") #:prefix "XS")
+             (index-text! term-generator (or (bug-tags bug) "") #:prefix "XT")
+             (index-text! term-generator (cond
+                                          ((bug-done bug) "done")
+                                          (else "open")) #:prefix "XSTATUS")
              (index-text! term-generator file #:prefix "F")
 
              ;; Index subject and body without prefixes for general
@@ -258,8 +265,12 @@ intact."
             (query (parse-query* querystring*
                                  #:stemmer (make-stem "en")
                                  #:prefixes '(("submitter" . "A")
-                                              ("author" . "XA")
-                                              ("subject" . "S")))))
+                                              ("author"    . "XA")
+                                              ("subject"   . "S")
+                                              ("owner"     . "XO")
+                                              ("severity"  . "XS")
+                                              ("tag"       . "XT")
+                                              ("status"    . "XSTATUS")))))
         ;; Fold over the results, return bug id.
         (mset-fold (lambda (item acc)
                      (cons