2011-07-20 Andrew Cohen <cohen@andy.bu.edu>
+ * nnir.el (gnus-group-make-nnir-group): Allow optional search query
+ argument.
+ (gnus-group-make-nnir-group, nnir-request-group, nnir-run-query): Use
+ `nnir-address' to handle server info rather than passing an arg.
+
* nnimap.el (nnimap-make-thread-query): New utility function to format
an imap thread search query.
(nnimap-request-thread): Use it.
(nnoo-declare nnir)
(nnoo-define-basics nnir)
+(defvoo nnir-address nil
+ "The address of the nnir server.")
+
(gnus-declare-backend "nnir" 'mail)
;; Gnus glue.
-(defun gnus-group-make-nnir-group (nnir-extra-parms)
+(defun gnus-group-make-nnir-group (nnir-extra-parms &optional parms)
"Create an nnir group. Asks for query."
(interactive "P")
(setq nnir-current-query nil
nnir-current-server nil
nnir-current-group-marked nil
nnir-artlist nil)
- (let* ((query (read-string "Query: " nil 'nnir-search-history))
- (parms (list (cons 'query query)))
- (srv (if (gnus-server-server-name)
- "all" "")))
- (add-to-list 'parms (cons 'unique-id (message-unique-id)) t)
+ (let* ((query (unless parms (read-string "Query: " nil 'nnir-search-history)))
+ (parms (or parms (list (cons 'query query))))
+ (srv (or (cdr (assq 'server parms)) (gnus-server-server-name) "nnir")))
+ (add-to-list 'parms (cons 'unique-id (message-unique-id)) t)
(gnus-group-read-ephemeral-group
(concat "nnir:" (prin1-to-string parms)) (list 'nnir srv) t
(cons (current-buffer) gnus-current-window-configuration)
(equal server nnir-current-server)))
nnir-artlist
;; Cache miss.
- (setq nnir-artlist (nnir-run-query group server)))
+ (setq nnir-artlist (nnir-run-query group)))
(with-current-buffer nntp-server-buffer
(setq nnir-current-query group)
(when server (setq nnir-current-server server))
(autoload 'gnus-group-topic-name "gnus-topic")
-(defun nnir-run-query (query nserver)
+(defun nnir-run-query (query)
"Invoke appropriate search engine function (see `nnir-engines').
If some groups were process-marked, run the query for each of the groups
and concat the results."
(let ((q (car (read-from-string query)))
- (groups (if (string= "all-ephemeral" nserver)
- (with-current-buffer gnus-server-buffer
- (list (list (gnus-server-server-name))))
+ (groups (if (not (string= "nnir" nnir-address))
+ (list (list nnir-address))
(nnir-categorize
(or gnus-group-marked
(if (gnus-group-group-name)