summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mumi/xapian.scm14
1 files changed, 12 insertions, 2 deletions
diff --git a/mumi/xapian.scm b/mumi/xapian.scm
index 925f67b..8024c6d 100644
--- a/mumi/xapian.scm
+++ b/mumi/xapian.scm
@@ -1,5 +1,5 @@
;;; mumi -- Mediocre, uh, mail interface
-;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2020, 2022 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This program is free software: you can redistribute it and/or
@@ -83,6 +83,14 @@ messages and index their contents in the Xapian database at DBPATH."
(match (assoc-ref (email-headers (last emails)) 'date)
((? string? s) #f)
(date date)))
+ ;; Store the message ids as base64 strings of all
+ ;; messages.
+ (msgids
+ (string-join (map (compose number->string string-hash)
+ (filter-map (lambda (headers)
+ (assoc-ref headers 'message-id))
+ (map email-headers emails)))
+ " "))
(text
(string-join (map (match-lambda
((($ <mime-entity> headers body) ...)
@@ -123,6 +131,7 @@ messages and index their contents in the Xapian database at DBPATH."
((bug-done bug) "done")
(else "open")) #:prefix "XSTATUS")
(index-text! term-generator file #:prefix "F")
+ (index-text! term-generator msgids #:prefix "XU")
;; Index subject and body without prefixes for general
;; search.
@@ -278,7 +287,8 @@ intact."
("owner" . "XO")
("severity" . "XS")
("tag" . "XT")
- ("status" . "XSTATUS"))))
+ ("status" . "XSTATUS")
+ ("msgid" . "XU"))))
(enq (enquire db query)))
;; Collapse on mergedwith value
(Enquire-set-collapse-key enq 2 1)