aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Danjou2010-10-28 10:41:27 +0000
committerKatsumi Yamaoka2010-10-28 10:41:27 +0000
commitcfe94935c8da4cf0650d6e5a0b3cce7b04279e52 (patch)
tree6289a83e7658da04c387260a70cc4114a0ae25a3
parent8289f37b64d3734339f8c82a1e444113873d8d25 (diff)
downloademacs-cfe94935c8da4cf0650d6e5a0b3cce7b04279e52.tar.gz
emacs-cfe94935c8da4cf0650d6e5a0b3cce7b04279e52.zip
nnir.el (nnir-run-swish-e): Remove hyrex support.
-rw-r--r--lisp/gnus/ChangeLog4
-rw-r--r--lisp/gnus/nnir.el137
2 files changed, 8 insertions, 133 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 15664e87aa6..1e57106a2be 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,7 @@
12010-10-28 Julien Danjou <julien@danjou.info>
2
3 * nnir.el (nnir-run-swish-e): Remove hyrex support.
4
12010-10-28 Katsumi Yamaoka <yamaoka@jpl.org> 52010-10-28 Katsumi Yamaoka <yamaoka@jpl.org>
2 6
3 * gnus-art.el (gnus-article-jump-to-part): Error on no part; fix prompt. 7 * gnus-art.el (gnus-article-jump-to-part): Error on no part; fix prompt.
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el
index a32d748a60c..adb8d094717 100644
--- a/lisp/gnus/nnir.el
+++ b/lisp/gnus/nnir.el
@@ -78,9 +78,8 @@
78 78
79;; Restrictions: 79;; Restrictions:
80;; 80;;
81;; * If you don't use HyREX as your search engine, this expects that 81;; * This expects that you use nnml or another one-file-per-message backend,
82;; you use nnml or another one-file-per-message backend, because the 82;; because the others doesn't support nnfolder.
83;; others doesn't support nnfolder.
84;; * It can only search the mail backend's which are supported by one 83;; * It can only search the mail backend's which are supported by one
85;; search engine, because of different query languages. 84;; search engine, because of different query languages.
86;; * There are restrictions to the Wais setup. 85;; * There are restrictions to the Wais setup.
@@ -96,8 +95,7 @@
96;; like this : 95;; like this :
97;; (setq gnus-secondary-select-methods '( 96;; (setq gnus-secondary-select-methods '(
98;; (nnimap "" (nnimap-address "localhost") 97;; (nnimap "" (nnimap-address "localhost")
99;; (nnir-search-engine hyrex) 98;; (nnir-search-engine namazu)
100;; (nnir-hyrex-additional-switches ("-d" "ddl-nnimap.xml"))
101;; ))) 99;; )))
102;; Or you can define the global ones. The variables set in the mailer- 100;; Or you can define the global ones. The variables set in the mailer-
103;; definition will be used first. 101;; definition will be used first.
@@ -227,18 +225,7 @@
227;; For maximum searching efficiency I have a cron job set to run this 225;; For maximum searching efficiency I have a cron job set to run this
228;; command every four hours. 226;; command every four hours.
229 227
230;; 3. HyREX 228;; 3. find-grep
231;;
232;; The HyREX backend requires you to have one directory from where all
233;; your relative paths are to, if you use them. This directory must be
234;; set in the `nnir-hyrex-index-directory' variable, which defaults to
235;; your home directory. You must also pass the base, class and
236;; directory options or simply your dll to the `nnir-hyrex-programm' by
237;; setting the `nnir-hyrex-additional-switches' variable accordently.
238;; To function the `nnir-hyrex-remove-prefix' variable must also be
239;; correct, see the documentation for `nnir-wais-remove-prefix' above.
240
241;; 4. find-grep
242;; 229;;
243;; The find-grep engine simply runs find(1) to locate eligible 230;; The find-grep engine simply runs find(1) to locate eligible
244;; articles and searches them with grep(1). This, of course, is much 231;; articles and searches them with grep(1). This, of course, is much
@@ -319,7 +306,6 @@
319;; are simple, but what about the article number? 306;; are simple, but what about the article number?
320;; - The article number is encoded in the `X-Gnus-Article-Number' 307;; - The article number is encoded in the `X-Gnus-Article-Number'
321;; header of each mail. 308;; header of each mail.
322;; - The HyREX engine supports nnfolder.
323;; 309;;
324;; * Support compressed mail files. Probably, just stripping off the 310;; * Support compressed mail files. Probably, just stripping off the
325;; `.gz' or `.Z' file name extension is sufficient. 311;; `.gz' or `.Z' file name extension is sufficient.
@@ -403,8 +389,6 @@ result, `gnus-retrieve-headers' will be called instead.")
403 ((group . "Group spec: "))) 389 ((group . "Group spec: ")))
404 (namazu nnir-run-namazu 390 (namazu nnir-run-namazu
405 ()) 391 ())
406 (hyrex nnir-run-hyrex
407 ((group . "Group spec: ")))
408 (find-grep nnir-run-find-grep 392 (find-grep nnir-run-find-grep
409 ((grep-options . "Grep options: ")))) 393 ((grep-options . "Grep options: "))))
410 "Alist of supported search engines. 394 "Alist of supported search engines.
@@ -575,40 +559,6 @@ This could be a server parameter."
575 :type '(regexp) 559 :type '(regexp)
576 :group 'nnir) 560 :group 'nnir)
577 561
578;; HyREX engine, see <URL:http://ls6-www.cs.uni-dortmund.de/>
579
580(defcustom nnir-hyrex-program "nnir-search"
581 "*Name of the nnir-search executable."
582 :type '(string)
583 :group 'nnir)
584
585(defcustom nnir-hyrex-additional-switches '()
586 "*A list of strings, to be given as additional arguments for nnir-search.
587Note that this should be a list. Ie, do NOT use the following:
588 (setq nnir-hyrex-additional-switches \"-ddl ddl.xml -c nnir\") ; wrong !
589Instead, use this:
590 (setq nnir-hyrex-additional-switches '(\"-ddl\" \"ddl.xml\" \"-c\" \"nnir\"))"
591 :type '(repeat (string))
592 :group 'nnir)
593
594(defcustom nnir-hyrex-index-directory (getenv "HOME")
595 "*Index directory for HyREX."
596 :type '(directory)
597 :group 'nnir)
598
599(defcustom nnir-hyrex-remove-prefix (concat (getenv "HOME") "/Mail/")
600 "*The prefix to remove from each file name returned by HyREX
601in order to get a group name (albeit with / instead of .).
602
603For example, suppose that HyREX returns file names such as
604\"/home/john/Mail/mail/misc/42\". For this example, use the following
605setting: (setq nnir-hyrex-remove-prefix \"/home/john/Mail/\")
606Note the trailing slash. Removing this prefix gives \"mail/misc/42\".
607`nnir' knows to remove the \"/42\" and to replace \"/\" with \".\" to
608arrive at the correct group name, \"mail.misc\"."
609 :type '(directory)
610 :group 'nnir)
611
612;; Namazu engine, see <URL:http://www.namazu.org/> 562;; Namazu engine, see <URL:http://www.namazu.org/>
613 563
614(defcustom nnir-namazu-program "namazu" 564(defcustom nnir-namazu-program "namazu"
@@ -1356,85 +1306,6 @@ Tested with swish-e-2.0.1 on Windows NT 4.0."
1356 (> (nnir-artitem-rsv x) 1306 (> (nnir-artitem-rsv x)
1357 (nnir-artitem-rsv y))))))))) 1307 (nnir-artitem-rsv y)))))))))
1358 1308
1359;; HyREX interface
1360(defun nnir-run-hyrex (query server &optional group)
1361 (save-excursion
1362 (let ((artlist nil)
1363 (groupspec (cdr (assq 'group query)))
1364 (qstring (cdr (assq 'query query)))
1365 (prefix (nnir-read-server-parm 'nnir-hyrex-remove-prefix server))
1366 score artno dirnam)
1367 (when (and group groupspec)
1368 (error (concat "It does not make sense to use a group spec"
1369 " with process-marked groups.")))
1370 (when group
1371 (setq groupspec (gnus-group-real-name group)))
1372 (when (and group (not (equal group (nnir-group-full-name groupspec server))))
1373 (message "%s vs. %s" group (nnir-group-full-name groupspec server))
1374 (error "Server with groupspec doesn't match group !"))
1375 (set-buffer (get-buffer-create nnir-tmp-buffer))
1376 (erase-buffer)
1377 (if groupspec
1378 (message "Doing hyrex-search query %s on %s..." query groupspec)
1379 (message "Doing hyrex-search query %s..." query))
1380 (let* ((cp-list
1381 `( ,nnir-hyrex-program
1382 nil ; input from /dev/null
1383 t ; output
1384 nil ; don't redisplay
1385 "-i",(nnir-read-server-parm 'nnir-hyrex-index-directory server) ; index directory
1386 ,@(nnir-read-server-parm 'nnir-hyrex-additional-switches server)
1387 ,qstring ; the query, in hyrex-search format
1388 ))
1389 (exitstatus
1390 (progn
1391 (message "%s args: %s" nnir-hyrex-program
1392 (mapconcat 'identity (cddddr cp-list) " "))
1393 (apply 'call-process cp-list))))
1394 (unless (or (null exitstatus)
1395 (zerop exitstatus))
1396 (nnheader-report 'nnir "Couldn't run hyrex-search: %s" exitstatus)
1397 ;; nnir-search failure reason is in this buffer, show it if
1398 ;; the user wants it.
1399 (when (> gnus-verbose 6)
1400 (display-buffer nnir-tmp-buffer)))) ;; FIXME: Dont clear buffer !
1401 (if groupspec
1402 (message "Doing hyrex-search query \"%s\" on %s...done" qstring groupspec)
1403 (message "Doing hyrex-search query \"%s\"...done" qstring))
1404 (sit-for 0)
1405 ;; nnir-search returns:
1406 ;; for nnml/nnfolder: "filename mailid weigth"
1407 ;; for nnimap: "group mailid weigth"
1408 (goto-char (point-min))
1409 (delete-non-matching-lines "^\\S + [0-9]+ [0-9]+$")
1410 ;; HyREX couldn't search directly in groups -- so filter out here.
1411 (when groupspec
1412 (keep-lines groupspec))
1413 ;; extract data from result lines
1414 (goto-char (point-min))
1415 (while (re-search-forward
1416 "\\(\\S +\\) \\([0-9]+\\) \\([0-9]+\\)" nil t)
1417 (setq dirnam (match-string 1)
1418 artno (match-string 2)
1419 score (match-string 3))
1420 (when (string-match prefix dirnam)
1421 (setq dirnam (replace-match "" t t dirnam)))
1422 (push (vector (nnir-group-full-name
1423 (gnus-replace-in-string dirnam "/" ".") server)
1424 (string-to-number artno)
1425 (string-to-number score))
1426 artlist))
1427 (message "Massaging hyrex-search output...done.")
1428 (apply 'vector
1429 (sort artlist
1430 (function (lambda (x y)
1431 (if (string-lessp (nnir-artitem-group x)
1432 (nnir-artitem-group y))
1433 t
1434 (< (nnir-artitem-number x)
1435 (nnir-artitem-number y)))))))
1436 )))
1437
1438;; Namazu interface 1309;; Namazu interface
1439(defun nnir-run-namazu (query server &optional group) 1310(defun nnir-run-namazu (query server &optional group)
1440 "Run given query against Namazu. Returns a vector of (group name, file name) 1311 "Run given query against Namazu. Returns a vector of (group name, file name)