* nnir.el: Lower case imap search terms. Cache and reuse imap search terms.
authorAndrew Cohen <cohen@andy.bu.edu>
Tue, 22 Feb 2011 17:34:22 +0000 (12:34 -0500)
committerAndrew Cohen <cohen@andy.bu.edu>
Tue, 22 Feb 2011 17:34:22 +0000 (12:34 -0500)
lisp/ChangeLog
lisp/nnir.el

index 2fb29bc..3a7359b 100644 (file)
@@ -1,3 +1,10 @@
+2011-02-22  Andrew Cohen  <cohen@andy.bu.edu>
+
+       * nnir.el (nnir-imap-search-arguments,nnir-imap-default-search-key):
+       Lower case names of search constraints.
+       (nnir-run-query): Cache and reuse search constraints for all imap
+       servers.
+
 2011-02-22  Lars Ingebrigtsen  <larsi@gnus.org>
 
        * gnus-msg.el (gnus-inews-add-send-actions): Restore the winconf name
index 8e91c68..eaaac3f 100644 (file)
 ;; Imap variables
 
 (defvar nnir-imap-search-arguments
-  '(("Whole message" . "TEXT")
-    ("Subject" . "SUBJECT")
-    ("To" . "TO")
-    ("From" . "FROM")
-    ("Imap" . ""))
+  '(("whole message" . "TEXT")
+    ("subject" . "SUBJECT")
+    ("to" . "TO")
+    ("from" . "FROM")
+    ("body" . "BODY")
+    ("imap" . ""))
   "Mapping from user readable keys to IMAP search items for use in nnir")
 
 (defvar nnir-imap-search-other "HEADER %S"
@@ -335,7 +336,7 @@ result, `gnus-retrieve-headers' will be called instead."
   :type '(function)
   :group 'nnir)
 
-(defcustom nnir-imap-default-search-key "Whole message"
+(defcustom nnir-imap-default-search-key "whole message"
   "*The default IMAP search key for an nnir search. Must be one of
   the keys in `nnir-imap-search-arguments'. To use raw imap queries
   by default set this to \"Imap\"."
@@ -1500,11 +1501,14 @@ Tested with Namazu 2.0.6 on a GNU/Linux system."
                (setq search-func (cadr (assoc nnir-search-engine
                                               nnir-engines)))
                (if search-func
-                   (funcall search-func
-                            (if nnir-extra-parms
-                                (nnir-read-parms q nnir-search-engine)
-                              q)
-                            server (cadr x))
+                   (funcall
+                    search-func
+                    (if nnir-extra-parms
+                        (or (and (eq nnir-search-engine 'imap)
+                                 (assq 'criteria q) q)
+                            (setq q (nnir-read-parms q nnir-search-engine)))
+                      q)
+                    server (cadr x))
                  nil)))
            groups))))