annotate lisp/gnus/nnir.el @ 110637:494ea2fb03d7

Remove Emacs 21 stuff. mm-util.el (mm-codepage-iso-8859-list, mm-charset-eval-alist, mm-mime-charset): Comment fix. rfc2047.el (rfc2047-syntax-table): Comment fix. utf7.el (utf7-utf-16-coding-system): Comment fix. nnrss.el (nnrss-read-server-data, nnrss-read-group-data): Use `load' rather than `insert-file-contents' and `eval-region'. pgg.el (pgg-run-at-time-1): Define it for XEmacs only; fix if/else construction. time-date.el: No need to require cl for Emacs 21.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Wed, 29 Sep 2010 01:09:50 +0000
parents 5e158658b471
children 2b8ece636433
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1 ;;; nnir.el --- search mail with various search engines -*- coding: iso-8859-1 -*-
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
2
95616
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105167
diff changeset
4 ;; 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
5
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
6 ;; Author: Kai Großjohann <grossjohann@ls6.cs.uni-dortmund.de>
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
7 ;; Swish-e and Swish++ backends by:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
8 ;; Christoph Conrad <christoph.conrad@gmx.de>.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
9 ;; IMAP backend by: Simon Josefsson <jas@pdc.kth.se>.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
10 ;; IMAP search by: Torsten Hilbrich <torsten.hilbrich <at> gmx.net>
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
11 ;; IMAP search improved by Daniel Pittman <daniel@rimspace.net>.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
12 ;; nnmaildir support for Swish++ and Namazu backends by:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
13 ;; Justus Piater <Justus <at> Piater.name>
95616
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
14 ;; Keywords: news mail searching ir
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
15
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
16 ;; This file is part of GNU Emacs.
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
17
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
18 ;; GNU Emacs is free software: you can redistribute it and/or modify
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
19 ;; it under the terms of the GNU General Public License as published by
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
20 ;; the Free Software Foundation, either version 3 of the License, or
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
21 ;; (at your option) any later version.
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
22
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
23 ;; GNU Emacs is distributed in the hope that it will be useful,
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
24 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
25 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
26 ;; GNU General Public License for more details.
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
27
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
28 ;; You should have received a copy of the GNU General Public License
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
29 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
30
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
31 ;;; Commentary:
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
32
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
33 ;; TODO: Documentation in the Gnus manual
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
34
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
35 ;; From: Reiner Steib
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
36 ;; Subject: Re: Including nnir.el
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
37 ;; Newsgroups: gmane.emacs.gnus.general
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
38 ;; Message-ID: <v9d5dnp6aq.fsf@marauder.physik.uni-ulm.de>
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
39 ;; Date: 2006-06-05 22:49:01 GMT
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
40 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
41 ;; On Sun, Jun 04 2006, Sascha Wilde wrote:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
42 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
43 ;; > The one thing most hackers like to forget: Documentation. By now the
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
44 ;; > documentation is only in the comments at the head of the source, I
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
45 ;; > would use it as basis to cook up some minimal texinfo docs.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
46 ;; >
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
47 ;; > Where in the existing gnus manual would this fit best?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
48
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
49 ;; Maybe (info "(gnus)Combined Groups") for a general description.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
50 ;; `gnus-group-make-nnir-group' might be described in (info
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
51 ;; "(gnus)Foreign Groups") as well.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
52
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
53
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
54 ;; The most recent version of this can always be fetched from the Gnus
107975
7d805250c222 Synch with Gnus trunk:
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
55 ;; repository. See http://www.gnus.org/ for more information.
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
56
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
57 ;; This code is still in the development stage but I'd like other
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
58 ;; people to have a look at it. Please do not hesitate to contact me
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
59 ;; with your ideas.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
60
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
61 ;; What does it do? Well, it allows you to index your mail using some
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
62 ;; search engine (freeWAIS-sf, swish-e and others -- see later),
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
63 ;; then type `G G' in the Group buffer and issue a query to the search
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
64 ;; engine. You will then get a buffer which shows all articles
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
65 ;; matching the query, sorted by Retrieval Status Value (score).
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
66
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
67 ;; When looking at the retrieval result (in the Summary buffer) you
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
68 ;; can type `G T' (aka M-x gnus-summary-nnir-goto-thread RET) on an
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
69 ;; article. You will be teleported into the group this article came
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
70 ;; from, showing the thread this article is part of. (See below for
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
71 ;; restrictions.)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
72
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
73 ;; The Lisp installation is simple: just put this file on your
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
74 ;; load-path, byte-compile it, and load it from ~/.gnus or something.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
75 ;; This will install a new command `G G' in your Group buffer for
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
76 ;; searching your mail. Note that you also need to configure a number
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
77 ;; of variables, as described below.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
78
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
79 ;; Restrictions:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
80 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
81 ;; * If you don't use HyREX as your search engine, this expects that
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
82 ;; you use nnml or another one-file-per-message backend, because the
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
83 ;; others doesn't support nnfolder.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
84 ;; * It can only search the mail backend's which are supported by one
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
85 ;; search engine, because of different query languages.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
86 ;; * There are restrictions to the Wais setup.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
87 ;; * There are restrictions to the imap setup.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
88 ;; * gnus-summary-nnir-goto-thread: Fetches whole group first, before
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
89 ;; limiting to the right articles. This is much too slow, of
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
90 ;; course. May issue a query for number of articles to fetch; you
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
91 ;; must accept the default of all articles at this point or things
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
92 ;; may break.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
93
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
94 ;; The Lisp setup involves setting a few variables and setting up the
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
95 ;; search engine. You can define the variables in the server definition
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
96 ;; like this :
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
97 ;; (setq gnus-secondary-select-methods '(
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
98 ;; (nnimap "" (nnimap-address "localhost")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
99 ;; (nnir-search-engine hyrex)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
100 ;; (nnir-hyrex-additional-switches ("-d" "ddl-nnimap.xml"))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
101 ;; )))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
102 ;; Or you can define the global ones. The variables set in the mailer-
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
103 ;; definition will be used first.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
104 ;; The variable to set is `nnir-search-engine'. Choose one of the engines
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
105 ;; listed in `nnir-engines'. (Actually `nnir-engines' is an alist,
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
106 ;; type `C-h v nnir-engines RET' for more information; this includes
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
107 ;; examples for setting `nnir-search-engine', too.)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
108 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
109 ;; The variable nnir-mail-backend isn't used anymore.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
110 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
111
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
112 ;; You must also set up a search engine. I'll tell you about the two
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
113 ;; search engines currently supported:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
114
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
115 ;; 1. freeWAIS-sf
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
116 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
117 ;; As always with freeWAIS-sf, you need a so-called `format file'. I
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
118 ;; use the following file:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
119 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
120 ;; ,-----
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
121 ;; | # Kai's format file for freeWAIS-sf for indexing mails.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
122 ;; | # Each mail is in a file, much like the MH format.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
123 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
124 ;; | # Document separator should never match -- each file is a document.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
125 ;; | record-sep: /^@this regex should never match@$/
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
126 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
127 ;; | # Searchable fields specification.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
128 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
129 ;; | region: /^[sS]ubject:/ /^[sS]ubject: */
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
130 ;; | subject "Subject header" stemming TEXT BOTH
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
131 ;; | end: /^[^ \t]/
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
132 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
133 ;; | region: /^([tT][oO]|[cC][cC]):/ /^([tT][oO]|[cC][cC]): */
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
134 ;; | to "To and Cc headers" SOUNDEX BOTH
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
135 ;; | end: /^[^ \t]/
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
136 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
137 ;; | region: /^[fF][rR][oO][mM]:/ /^[fF][rR][oO][mM]: */
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
138 ;; | from "From header" SOUNDEX BOTH
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
139 ;; | end: /^[^ \t]/
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
140 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
141 ;; | region: /^$/
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
142 ;; | stemming TEXT GLOBAL
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
143 ;; | end: /^@this regex should never match@$/
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
144 ;; `-----
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
145 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
146 ;; 1998-07-22: waisindex would dump core on me for large articles with
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
147 ;; the above settings. I used /^$/ as the end regex for the global
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
148 ;; field. That seemed to work okay.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
149
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
150 ;; There is a Perl module called `WAIS.pm' which is available from
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
151 ;; CPAN as well as ls6-ftp.cs.uni-dortmund.de:/pub/wais/Perl. This
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
152 ;; module comes with a nifty tool called `makedb', which I use for
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
153 ;; indexing. Here's my `makedb.conf':
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
154 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
155 ;; ,-----
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
156 ;; | # Config file for makedb
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
157 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
158 ;; | # Global options
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
159 ;; | waisindex = /usr/local/bin/waisindex
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
160 ;; | wais_opt = -stem -t fields
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
161 ;; | # `-stem' option necessary when `stemming' is specified for the
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
162 ;; | # global field in the *.fmt file
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
163 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
164 ;; | # Own variables
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
165 ;; | homedir = /home/kai
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
166 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
167 ;; | # The mail database.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
168 ;; | database = mail
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
169 ;; | files = `find $homedir/Mail -name \*[0-9] -print`
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
170 ;; | dbdir = $homedir/.wais
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
171 ;; | limit = 100
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
172 ;; `-----
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
173 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
174 ;; The Lisp setup involves the `nnir-wais-*' variables. The most
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
175 ;; difficult to understand variable is probably
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
176 ;; `nnir-wais-remove-prefix'. Here's what it does: the output of
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
177 ;; `waissearch' basically contains the file name and the (full)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
178 ;; directory name. As Gnus works with group names rather than
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
179 ;; directory names, the directory name is transformed into a group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
180 ;; name as follows: first, a prefix is removed from the (full)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
181 ;; directory name, then all `/' are replaced with `.'. The variable
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
182 ;; `nnir-wais-remove-prefix' should contain a regex matching exactly
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
183 ;; this prefix. It defaults to `$HOME/Mail/' (note the trailing
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
184 ;; slash).
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
185
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
186 ;; 2. Namazu
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
187 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
188 ;; The Namazu backend requires you to have one directory containing all
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
189 ;; index files, this is controlled by the `nnir-namazu-index-directory'
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
190 ;; variable. To function the `nnir-namazu-remove-prefix' variable must
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
191 ;; also be correct, see the documentation for `nnir-wais-remove-prefix'
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
192 ;; above.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
193 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
194 ;; It is particularly important not to pass any any switches to namazu
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
195 ;; that will change the output format. Good switches to use include
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
196 ;; `--sort', `--ascending', `--early' and `--late'. Refer to the Namazu
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
197 ;; documentation for further information on valid switches.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
198 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
199 ;; To index my mail with the `mknmz' program I use the following
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
200 ;; configuration file:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
201 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
202 ;; ,----
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
203 ;; | package conf; # Don't remove this line!
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
204 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
205 ;; | # Paths which will not be indexed. Don't use `^' or `$' anchors.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
206 ;; | $EXCLUDE_PATH = "spam|sent";
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
207 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
208 ;; | # Header fields which should be searchable. case-insensitive
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
209 ;; | $REMAIN_HEADER = "from|date|message-id|subject";
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
210 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
211 ;; | # Searchable fields. case-insensitive
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
212 ;; | $SEARCH_FIELD = "from|date|message-id|subject";
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
213 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
214 ;; | # The max length of a word.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
215 ;; | $WORD_LENG_MAX = 128;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
216 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
217 ;; | # The max length of a field.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
218 ;; | $MAX_FIELD_LENGTH = 256;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
219 ;; `----
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
220 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
221 ;; My mail is stored in the directories ~/Mail/mail/, ~/Mail/lists/ and
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
222 ;; ~/Mail/archive/, so to index them I go to the directory set in
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
223 ;; `nnir-namazu-index-directory' and issue the following command.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
224 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
225 ;; mknmz --mailnews ~/Mail/archive/ ~/Mail/mail/ ~/Mail/lists/
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
226 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
227 ;; For maximum searching efficiency I have a cron job set to run this
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
228 ;; command every four hours.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
229
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
230 ;; 3. HyREX
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
231 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
232 ;; The HyREX backend requires you to have one directory from where all
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
233 ;; your relative paths are to, if you use them. This directory must be
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
234 ;; set in the `nnir-hyrex-index-directory' variable, which defaults to
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
235 ;; your home directory. You must also pass the base, class and
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
236 ;; directory options or simply your dll to the `nnir-hyrex-programm' by
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
237 ;; setting the `nnir-hyrex-additional-switches' variable accordently.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
238 ;; To function the `nnir-hyrex-remove-prefix' variable must also be
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
239 ;; correct, see the documentation for `nnir-wais-remove-prefix' above.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
240
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
241 ;; 4. find-grep
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
242 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
243 ;; The find-grep engine simply runs find(1) to locate eligible
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
244 ;; articles and searches them with grep(1). This, of course, is much
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
245 ;; slower than using a proper search engine but OTOH doesn't require
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
246 ;; maintenance of an index and is still faster than using any built-in
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
247 ;; means for searching. The method specification of the server to
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
248 ;; search must include a directory for this engine to work (E.g.,
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
249 ;; `nnml-directory'). The tools must be POSIX compliant. GNU Find
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
250 ;; prior to version 4.2.12 (4.2.26 on Linux due to incorrect ARG_MAX
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
251 ;; handling) does not work.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
252 ;; ,----
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
253 ;; | ;; find-grep configuration for searching the Gnus Cache
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
254 ;; |
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
255 ;; | (nnml "cache"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
256 ;; | (nnml-get-new-mail nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
257 ;; | (nnir-search-engine find-grep)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
258 ;; | (nnml-directory "~/News/cache/")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
259 ;; | (nnml-active-file "~/News/cache/active"))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
260 ;; `----
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
261
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
262 ;; Developer information:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
263
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
264 ;; I have tried to make the code expandable. Basically, it is divided
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
265 ;; into two layers. The upper layer is somewhat like the `nnvirtual'
110100
8f51744211eb Remove nndb, nnkiboze and related code.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107978
diff changeset
266 ;; backend: given a specification of what articles to show from
8f51744211eb Remove nndb, nnkiboze and related code.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107978
diff changeset
267 ;; another backend, it creates a group containing exactly those
8f51744211eb Remove nndb, nnkiboze and related code.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107978
diff changeset
268 ;; articles. The lower layer issues a query to a search engine and
8f51744211eb Remove nndb, nnkiboze and related code.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107978
diff changeset
269 ;; produces such a specification of what articles to show from the
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
270 ;; other backend.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
271
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
272 ;; The interface between the two layers consists of the single
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
273 ;; function `nnir-run-query', which just selects the appropriate
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
274 ;; function for the search engine one is using. The input to
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
275 ;; `nnir-run-query' is a string, representing the query as input by
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
276 ;; the user. The output of `nnir-run-query' is supposed to be a
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
277 ;; vector, each element of which should in turn be a three-element
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
278 ;; vector. The first element should be full group name of the article,
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
279 ;; the second element should be the article number, and the third
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
280 ;; element should be the Retrieval Status Value (RSV) as returned from
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
281 ;; the search engine. An RSV is the score assigned to the document by
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
282 ;; the search engine. For Boolean search engines, the
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
283 ;; RSV is always 1000 (or 1 or 100, or whatever you like).
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
284
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
285 ;; The sorting order of the articles in the summary buffer created by
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
286 ;; nnir is based on the order of the articles in the above mentioned
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
287 ;; vector, so that's where you can do the sorting you'd like. Maybe
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
288 ;; it would be nice to have a way of displaying the search result
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
289 ;; sorted differently?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
290
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
291 ;; So what do you need to do when you want to add another search
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
292 ;; engine? You write a function that executes the query. Temporary
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
293 ;; data from the search engine can be put in `nnir-tmp-buffer'. This
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
294 ;; function should return the list of articles as a vector, as
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
295 ;; described above. Then, you need to register this backend in
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
296 ;; `nnir-engines'. Then, users can choose the backend by setting
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
297 ;; `nnir-search-engine'.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
298
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
299 ;; Todo, or future ideas:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
300
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
301 ;; * It should be possible to restrict search to certain groups.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
302 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
303 ;; * There is currently no error checking.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
304 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
305 ;; * The summary buffer display is currently really ugly, with all the
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
306 ;; added information in the subjects. How could I make this
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
307 ;; prettier?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
308 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
309 ;; * A function which can be called from an nnir summary buffer which
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
310 ;; teleports you into the group the current article came from and
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
311 ;; shows you the whole thread this article is part of.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
312 ;; Implementation suggestions?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
313 ;; (1998-07-24: There is now a preliminary implementation, but
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
314 ;; it is much too slow and quite fragile.)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
315 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
316 ;; * Support other mail backends. In particular, probably quite a few
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
317 ;; people use nnfolder. How would one go about searching nnfolders
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
318 ;; and producing the right data needed? The group name and the RSV
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
319 ;; are simple, but what about the article number?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
320 ;; - The article number is encoded in the `X-Gnus-Article-Number'
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
321 ;; header of each mail.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
322 ;; - The HyREX engine supports nnfolder.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
323 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
324 ;; * Support compressed mail files. Probably, just stripping off the
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
325 ;; `.gz' or `.Z' file name extension is sufficient.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
326 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
327 ;; * At least for imap, the query is performed twice.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
328 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
329
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
330 ;; Have you got other ideas?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
331
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
332 ;;; Setup Code:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
333
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
334 (require 'nnoo)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
335 (require 'gnus-group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
336 (require 'gnus-sum)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
337 (require 'message)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
338 (require 'gnus-util)
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
339 (eval-when-compile
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
340 (require 'cl))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
341
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
342 (nnoo-declare nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
343 (nnoo-define-basics nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
344
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
345 (gnus-declare-backend "nnir" 'mail)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
346
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
347 (defvar nnir-imap-search-field "TEXT"
110569
5e158658b471 nnir.el (nnir-run-imap): Allow sending IMAP search patterns directly.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110517
diff changeset
348 "The IMAP search item when doing an nnir search. To use raw
5e158658b471 nnir.el (nnir-run-imap): Allow sending IMAP search patterns directly.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110517
diff changeset
349 imap queries by default set this to \"\"")
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
350
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
351 (defvar nnir-imap-search-arguments
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
352 '(("Whole message" . "TEXT")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
353 ("Subject" . "SUBJECT")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
354 ("To" . "TO")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
355 ("From" . "FROM")
110569
5e158658b471 nnir.el (nnir-run-imap): Allow sending IMAP search patterns directly.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110517
diff changeset
356 ("Head" . "HEADER \"%s\"")
5e158658b471 nnir.el (nnir-run-imap): Allow sending IMAP search patterns directly.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110517
diff changeset
357 (nil . ""))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
358 "Mapping from user readable strings to IMAP search items for use in nnir")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
359
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
360 (defvar nnir-imap-search-argument-history ()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
361 "The history for querying search options in nnir")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
362
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
363 (defvar nnir-get-article-nov-override-function nil
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
364 "If non-nil, a function that will be passed each search result. This
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
365 should return a message's headers in NOV format.
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
366
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
367 If this variable is nil, or if the provided function returns nil for a search
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
368 result, `gnus-retrieve-headers' will be called instead.")
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
369
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
370
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
371 ;;; Developer Extension Variable:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
372
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
373 (defvar nnir-engines
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
374 `((wais nnir-run-waissearch
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
375 ())
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
376 (imap nnir-run-imap
95616
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
377 ((criteria
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
378 "Search in: " ; Prompt
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
379 ,nnir-imap-search-arguments ; alist for completing
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
380 nil ; no filtering
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
381 nil ; allow any user input
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
382 nil ; initial value
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
383 nnir-imap-search-argument-history ; the history to use
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
384 ,nnir-imap-search-field ; default
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
385 )))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
386 (swish++ nnir-run-swish++
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
387 ((group . "Group spec: ")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
388 (swish-e nnir-run-swish-e
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
389 ((group . "Group spec: ")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
390 (namazu nnir-run-namazu
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
391 ())
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
392 (hyrex nnir-run-hyrex
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
393 ((group . "Group spec: ")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
394 (find-grep nnir-run-find-grep
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
395 ((grep-options . "Grep options: "))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
396 "Alist of supported search engines.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
397 Each element in the alist is a three-element list (ENGINE FUNCTION ARGS).
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
398 ENGINE is a symbol designating the searching engine. FUNCTION is also
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
399 a symbol, giving the function that does the search. The third element
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
400 ARGS is a list of cons pairs (PARAM . PROMPT). When issuing a query,
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
401 the FUNCTION will issue a query for each of the PARAMs, using PROMPT.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
402
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
403 The value of `nnir-search-engine' must be one of the ENGINE symbols.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
404 For example, use the following line for searching using freeWAIS-sf:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
405 (setq nnir-search-engine 'wais)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
406 Use the following line if you read your mail via IMAP and your IMAP
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
407 server supports searching:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
408 (setq nnir-search-engine 'imap)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
409 Note that you have to set additional variables for most backends. For
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
410 example, the `wais' backend needs the variables `nnir-wais-program',
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
411 `nnir-wais-database' and `nnir-wais-remove-prefix'.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
412
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
413 Add an entry here when adding a new search engine.")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
414
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
415 ;;; User Customizable Variables:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
416
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
417 (defgroup nnir nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
418 "Search nnmh and nnml groups in Gnus with swish-e, freeWAIS-sf, or EWS."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
419 :group 'gnus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
420
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
421 ;; Mail backend.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
422
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
423 ;; TODO:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
424 ;; If `nil', use server parameters to find out which server to search. CCC
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
425 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
426 (defcustom nnir-mail-backend '(nnml "")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
427 "*Specifies which backend should be searched.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
428 More precisely, this is used to determine from which backend to fetch the
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
429 messages found.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
430
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
431 This must be equal to an existing server, so maybe it is best to use
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
432 something like the following:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
433 (setq nnir-mail-backend (nth 0 gnus-secondary-select-methods))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
434 The above line works fine if the mail backend you want to search is
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
435 the first element of gnus-secondary-select-methods (`nth' starts counting
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
436 at zero)."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
437 :type '(sexp)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
438 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
439
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
440 ;; Search engine to use.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
441
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
442 (defcustom nnir-search-engine 'wais
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
443 "*The search engine to use. Must be a symbol.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
444 See `nnir-engines' for a list of supported engines, and for example
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
445 settings of `nnir-search-engine'."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
446 :type '(sexp)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
447 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
448
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
449 ;; freeWAIS-sf.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
450
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
451 (defcustom nnir-wais-program "waissearch"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
452 "*Name of waissearch executable."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
453 :type '(string)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
454 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
455
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
456 (defcustom nnir-wais-database (expand-file-name "~/.wais/mail")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
457 "*Name of Wais database containing the mail.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
458
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
459 Note that this should be a file name without extension. For example,
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
460 if you have a file /home/john/.wais/mail.fmt, use this:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
461 (setq nnir-wais-database \"/home/john/.wais/mail\")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
462 The string given here is passed to `waissearch -d' as-is."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
463 :type '(file)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
464 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
465
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
466 (defcustom nnir-wais-remove-prefix (concat (getenv "HOME") "/Mail/")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
467 "*The prefix to remove from each directory name returned by waissearch
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
468 in order to get a group name (albeit with / instead of .). This is a
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
469 regular expression.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
470
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
471 For example, suppose that Wais returns file names such as
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
472 \"/home/john/Mail/mail/misc/42\". For this example, use the following
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
473 setting: (setq nnir-wais-remove-prefix \"/home/john/Mail/\")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
474 Note the trailing slash. Removing this prefix gives \"mail/misc/42\".
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
475 `nnir' knows to remove the \"/42\" and to replace \"/\" with \".\" to
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
476 arrive at the correct group name, \"mail.misc\"."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
477 :type '(regexp)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
478 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
479
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
480 (defcustom nnir-swish++-configuration-file
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
481 (expand-file-name "~/Mail/swish++.conf")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
482 "*Configuration file for swish++."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
483 :type '(file)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
484 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
485
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
486 (defcustom nnir-swish++-program "search"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
487 "*Name of swish++ search executable."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
488 :type '(string)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
489 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
490
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
491 (defcustom nnir-swish++-additional-switches '()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
492 "*A list of strings, to be given as additional arguments to swish++.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
493
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
494 Note that this should be a list. Ie, do NOT use the following:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
495 (setq nnir-swish++-additional-switches \"-i -w\") ; wrong
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
496 Instead, use this:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
497 (setq nnir-swish++-additional-switches '(\"-i\" \"-w\"))"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
498 :type '(repeat (string))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
499 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
500
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
501 (defcustom nnir-swish++-remove-prefix (concat (getenv "HOME") "/Mail/")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
502 "*The prefix to remove from each file name returned by swish++
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
503 in order to get a group name (albeit with / instead of .). This is a
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
504 regular expression.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
505
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
506 This variable is very similar to `nnir-wais-remove-prefix', except
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
507 that it is for swish++, not Wais."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
508 :type '(regexp)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
509 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
510
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
511 ;; Swish-E.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
512 ;; URL: http://sunsite.berkeley.edu/SWISH-E/
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
513 ;; New version: http://www.boe.es/swish-e
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
514 ;; Variables `nnir-swish-e-index-file', `nnir-swish-e-program' and
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
515 ;; `nnir-swish-e-additional-switches'
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
516
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
517 (make-obsolete-variable 'nnir-swish-e-index-file
104700
9866b069527c * spam.el (spam-ifile-path, spam-bogofilter-path, spam-sa-learn-path)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 104584
diff changeset
518 'nnir-swish-e-index-files "Emacs 23.1")
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
519 (defcustom nnir-swish-e-index-file
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
520 (expand-file-name "~/Mail/index.swish-e")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
521 "*Index file for swish-e.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
522 This could be a server parameter.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
523 It is never consulted once `nnir-swish-e-index-files', which should be
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
524 used instead, has been customized."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
525 :type '(file)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
526 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
527
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
528 (defcustom nnir-swish-e-index-files
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
529 (list nnir-swish-e-index-file)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
530 "*List of index files for swish-e.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
531 This could be a server parameter."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
532 :type '(repeat (file))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
533 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
534
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
535 (defcustom nnir-swish-e-program "swish-e"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
536 "*Name of swish-e search executable.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
537 This cannot be a server parameter."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
538 :type '(string)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
539 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
540
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
541 (defcustom nnir-swish-e-additional-switches '()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
542 "*A list of strings, to be given as additional arguments to swish-e.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
543
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
544 Note that this should be a list. Ie, do NOT use the following:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
545 (setq nnir-swish-e-additional-switches \"-i -w\") ; wrong
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
546 Instead, use this:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
547 (setq nnir-swish-e-additional-switches '(\"-i\" \"-w\"))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
548
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
549 This could be a server parameter."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
550 :type '(repeat (string))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
551 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
552
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
553 (defcustom nnir-swish-e-remove-prefix (concat (getenv "HOME") "/Mail/")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
554 "*The prefix to remove from each file name returned by swish-e
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
555 in order to get a group name (albeit with / instead of .). This is a
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
556 regular expression.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
557
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
558 This variable is very similar to `nnir-wais-remove-prefix', except
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
559 that it is for swish-e, not Wais.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
560
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
561 This could be a server parameter."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
562 :type '(regexp)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
563 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
564
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
565 ;; HyREX engine, see <URL:http://ls6-www.cs.uni-dortmund.de/>
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
566
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
567 (defcustom nnir-hyrex-program "nnir-search"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
568 "*Name of the nnir-search executable."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
569 :type '(string)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
570 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
571
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
572 (defcustom nnir-hyrex-additional-switches '()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
573 "*A list of strings, to be given as additional arguments for nnir-search.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
574 Note that this should be a list. Ie, do NOT use the following:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
575 (setq nnir-hyrex-additional-switches \"-ddl ddl.xml -c nnir\") ; wrong !
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
576 Instead, use this:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
577 (setq nnir-hyrex-additional-switches '(\"-ddl\" \"ddl.xml\" \"-c\" \"nnir\"))"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
578 :type '(repeat (string))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
579 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
580
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
581 (defcustom nnir-hyrex-index-directory (getenv "HOME")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
582 "*Index directory for HyREX."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
583 :type '(directory)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
584 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
585
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
586 (defcustom nnir-hyrex-remove-prefix (concat (getenv "HOME") "/Mail/")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
587 "*The prefix to remove from each file name returned by HyREX
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
588 in order to get a group name (albeit with / instead of .).
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
589
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
590 For example, suppose that HyREX returns file names such as
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
591 \"/home/john/Mail/mail/misc/42\". For this example, use the following
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
592 setting: (setq nnir-hyrex-remove-prefix \"/home/john/Mail/\")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
593 Note the trailing slash. Removing this prefix gives \"mail/misc/42\".
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
594 `nnir' knows to remove the \"/42\" and to replace \"/\" with \".\" to
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
595 arrive at the correct group name, \"mail.misc\"."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
596 :type '(directory)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
597 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
598
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
599 ;; Namazu engine, see <URL:http://ww.namazu.org/>
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
600
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
601 (defcustom nnir-namazu-program "namazu"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
602 "*Name of Namazu search executable."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
603 :type '(string)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
604 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
605
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
606 (defcustom nnir-namazu-index-directory (expand-file-name "~/Mail/namazu/")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
607 "*Index directory for Namazu."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
608 :type '(directory)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
609 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
611 (defcustom nnir-namazu-additional-switches '()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
612 "*A list of strings, to be given as additional arguments to namazu.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
613 The switches `-q', `-a', and `-s' are always used, very few other switches
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
614 make any sense in this context.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
615
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
616 Note that this should be a list. Ie, do NOT use the following:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
617 (setq nnir-namazu-additional-switches \"-i -w\") ; wrong
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
618 Instead, use this:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
619 (setq nnir-namazu-additional-switches '(\"-i\" \"-w\"))"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
620 :type '(repeat (string))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
621 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
622
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
623 (defcustom nnir-namazu-remove-prefix (concat (getenv "HOME") "/Mail/")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
624 "*The prefix to remove from each file name returned by Namazu
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
625 in order to get a group name (albeit with / instead of .).
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
626
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
627 This variable is very similar to `nnir-wais-remove-prefix', except
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
628 that it is for Namazu, not Wais."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
629 :type '(directory)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
630 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
631
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
632 ;;; Internal Variables:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
633
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
634 (defvar nnir-current-query nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
635 "Internal: stores current query (= group name).")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
636
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
637 (defvar nnir-current-server nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
638 "Internal: stores current server (does it ever change?).")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
639
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
640 (defvar nnir-current-group-marked nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
641 "Internal: stores current list of process-marked groups.")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
642
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
643 (defvar nnir-artlist nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
644 "Internal: stores search result.")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
645
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
646 (defvar nnir-tmp-buffer " *nnir*"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
647 "Internal: temporary buffer.")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
648
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
649 ;;; Code:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
650
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
651 ;; Gnus glue.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
652
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
653 (defun gnus-group-make-nnir-group (extra-parms query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
654 "Create an nnir group. Asks for query."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
655 (interactive "P\nsQuery: ")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
656 (setq nnir-current-query nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
657 nnir-current-server nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
658 nnir-current-group-marked nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
659 nnir-artlist nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
660 (let ((parms nil))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
661 (if extra-parms
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
662 (setq parms (nnir-read-parms query))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
663 (setq parms (list (cons 'query query))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
664 (add-to-list 'parms (cons 'unique-id (message-unique-id)) t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
665 (gnus-group-read-ephemeral-group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
666 (concat "nnir:" (prin1-to-string parms)) '(nnir "") t
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
667 (cons (current-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
668 gnus-current-window-configuration)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
669 nil)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
670
95830
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
671 (eval-when-compile
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
672 (when (featurep 'xemacs)
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
673 ;; The `kbd' macro requires that the `read-kbd-macro' macro is available.
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
674 (require 'edmacro)))
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
675
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
676 (defun nnir-group-mode-hook ()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
677 (define-key gnus-group-mode-map (kbd "G G")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
678 'gnus-group-make-nnir-group))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
679 (add-hook 'gnus-group-mode-hook 'nnir-group-mode-hook)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
680
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
681 ;; Why is this needed? Is this for compatibility with old/new gnusae? Using
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
682 ;; gnus-group-server instead works for me. -- Justus Piater
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
683 (defmacro nnir-group-server (group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
684 "Return the server for a newsgroup GROUP.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
685 The returned format is as `gnus-server-to-method' needs it. See
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
686 `gnus-group-real-prefix' and `gnus-group-real-name'."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
687 `(let ((gname ,group))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
688 (if (string-match "^\\([^:]+\\):" gname)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
689 (progn
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
690 (setq gname (match-string 1 gname))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
691 (if (string-match "^\\([^+]+\\)\\+\\(.+\\)$" gname)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
692 (format "%s:%s" (match-string 1 gname) (match-string 2 gname))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
693 (concat gname ":")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
694 (format "%s:%s" (car gnus-select-method) (cadr gnus-select-method)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
695
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
696 ;; Summary mode commands.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
697
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
698 (defun gnus-summary-nnir-goto-thread ()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
699 "Only applies to nnir groups. Go to group this article came from
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
700 and show thread that contains this article."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
701 (interactive)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
702 (unless (eq 'nnir (car (gnus-find-method-for-group gnus-newsgroup-name)))
105167
e14dfafc8256 * gnus-art.el (gnus-article-encrypt-body):
Juanma Barranquero <lekktu@gmail.com>
parents: 104700
diff changeset
703 (error "Can't execute this command unless in nnir group"))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
704 (let* ((cur (gnus-summary-article-number))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
705 (group (nnir-artlist-artitem-group nnir-artlist cur))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
706 (backend-number (nnir-artlist-artitem-number nnir-artlist cur))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
707 server backend-group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
708 (setq server (nnir-group-server group))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
709 (setq backend-group (gnus-group-real-name group))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
710 (gnus-group-read-ephemeral-group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
711 backend-group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
712 (gnus-server-to-method server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
713 t ; activate
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
714 (cons (current-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
715 'summary) ; window config
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
716 nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
717 (list backend-number))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
718 (gnus-summary-limit (list backend-number))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
719 (gnus-summary-refer-thread)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
720
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
721 (if (fboundp 'eval-after-load)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
722 (eval-after-load "gnus-sum"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
723 '(define-key gnus-summary-goto-map
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
724 "T" 'gnus-summary-nnir-goto-thread))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
725 (add-hook 'gnus-summary-mode-hook
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
726 (function (lambda ()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
727 (define-key gnus-summary-goto-map
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
728 "T" 'gnus-summary-nnir-goto-thread)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
729
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
730
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
731
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
732 ;; Gnus backend interface functions.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
733
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
734 (deffoo nnir-open-server (server &optional definitions)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
735 ;; Just set the server variables appropriately.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
736 (nnoo-change-server 'nnir server definitions))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
737
110422
93e093c035a0 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
738 (deffoo nnir-request-group (group &optional server fast info)
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
739 "GROUP is the query string."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
740 (nnir-possibly-change-server server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
741 ;; Check for cache and return that if appropriate.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
742 (if (and (equal group nnir-current-query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
743 (equal gnus-group-marked nnir-current-group-marked)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
744 (or (null server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
745 (equal server nnir-current-server)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
746 nnir-artlist
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
747 ;; Cache miss.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
748 (setq nnir-artlist (nnir-run-query group)))
110410
f2e111723c3a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110111
diff changeset
749 (with-current-buffer nntp-server-buffer
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
750 (if (zerop (length nnir-artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
751 (progn
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
752 (setq nnir-current-query nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
753 nnir-current-server nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
754 nnir-current-group-marked nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
755 nnir-artlist nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
756 (nnheader-report 'nnir "Search produced empty results."))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
757 ;; Remember data for cache.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
758 (setq nnir-current-query group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
759 (when server (setq nnir-current-server server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
760 (setq nnir-current-group-marked gnus-group-marked)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
761 (nnheader-insert "211 %d %d %d %s\n"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
762 (nnir-artlist-length nnir-artlist) ; total #
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
763 1 ; first #
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
764 (nnir-artlist-length nnir-artlist) ; last #
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
765 group)))) ; group name
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
766
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
767 (deffoo nnir-retrieve-headers (articles &optional group server fetch-old)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
768 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
769 (let ((artlist (copy-sequence articles))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
770 art artitem artgroup artno artrsv artfullgroup
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
771 novitem novdata foo server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
772 (while (not (null artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
773 (setq art (car artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
774 (or (numberp art)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
775 (nnheader-report
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
776 'nnir
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
777 "nnir-retrieve-headers doesn't grok message ids: %s"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
778 art))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
779 (setq artitem (nnir-artlist-article nnir-artlist art))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
780 (setq artrsv (nnir-artitem-rsv artitem))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
781 (setq artfullgroup (nnir-artitem-group artitem))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
782 (setq artno (nnir-artitem-number artitem))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
783 (setq artgroup (gnus-group-real-name artfullgroup))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
784 (setq server (nnir-group-server artfullgroup))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
785 ;; retrieve NOV or HEAD data for this article, transform into
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
786 ;; NOV data and prepend to `novdata'
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
787 (set-buffer nntp-server-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
788 (nnir-possibly-change-server server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
789 (let ((gnus-override-method
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
790 (gnus-server-to-method server)))
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
791 ;; if nnir-get-article-nov-override-function is set, use it
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
792 (if nnir-get-article-nov-override-function
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
793 (setq novitem (funcall nnir-get-article-nov-override-function
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
794 artitem))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
795 ;; else, set novitem through nnheader-parse-nov/nnheader-parse-head
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
796 (case (setq foo (gnus-retrieve-headers (list artno)
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
797 artfullgroup nil))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
798 (nov
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
799 (goto-char (point-min))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
800 (setq novitem (nnheader-parse-nov))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
801 (unless novitem
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
802 (pop-to-buffer nntp-server-buffer)
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
803 (error
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
804 "nnheader-parse-nov returned nil for article %s in group %s"
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
805 artno artfullgroup)))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
806 (headers
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
807 (goto-char (point-min))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
808 (setq novitem (nnheader-parse-head))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
809 (unless novitem
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
810 (pop-to-buffer nntp-server-buffer)
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
811 (error
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
812 "nnheader-parse-head returned nil for article %s in group %s"
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
813 artno artfullgroup)))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
814 (t (error "Unknown header type %s while requesting article %s of group %s"
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
815 foo artno artfullgroup)))))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
816 ;; replace article number in original group with article number
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
817 ;; in nnir group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
818 (mail-header-set-number novitem art)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
819 (mail-header-set-from novitem
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
820 (mail-header-from novitem))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
821 (mail-header-set-subject
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
822 novitem
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
823 (format "[%d: %s/%d] %s"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
824 artrsv artgroup artno
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
825 (mail-header-subject novitem)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
826 ;;-(mail-header-set-extra novitem nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
827 (push novitem novdata)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
828 (setq artlist (cdr artlist)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
829 (setq novdata (nreverse novdata))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
830 (set-buffer nntp-server-buffer) (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
831 (mapc 'nnheader-insert-nov novdata)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
832 'nov)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
833
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
834 (deffoo nnir-request-article (article
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
835 &optional group server to-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
836 (if (stringp article)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
837 (nnheader-report
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
838 'nnir
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
839 "nnir-retrieve-headers doesn't grok message ids: %s"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
840 article)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
841 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
842 (let* ((artitem (nnir-artlist-article nnir-artlist
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
843 article))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
844 (artfullgroup (nnir-artitem-group artitem))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
845 (artno (nnir-artitem-number artitem))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
846 ;; Bug?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
847 ;; Why must we bind nntp-server-buffer here? It won't
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
848 ;; work if `buf' is used, say. (Of course, the set-buffer
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
849 ;; line below must then be updated, too.)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
850 (nntp-server-buffer (or to-buffer nntp-server-buffer)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
851 (set-buffer nntp-server-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
852 (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
853 (message "Requesting article %d from group %s"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
854 artno artfullgroup)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
855 (gnus-request-article artno artfullgroup nntp-server-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
856 (cons artfullgroup artno)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
857
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
858
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
859 (nnoo-define-skeleton nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
860
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
861
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
862 (defmacro nnir-add-result (dirnam artno score prefix server artlist)
95616
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
863 "Ask `nnir-compose-result' to construct a result vector,
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
864 and if it is non-nil, add it to artlist."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
865 `(let ((result (nnir-compose-result ,dirnam ,artno ,score ,prefix ,server)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
866 (when (not (null result))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
867 (push result ,artlist))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
868
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
869 (autoload 'nnmaildir-base-name-to-article-number "nnmaildir")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
870
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
871 ;; Helper function currently used by the Swish++ and Namazu backends;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
872 ;; perhaps useful for other backends as well
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
873 (defun nnir-compose-result (dirnam article score prefix server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
874 "Extract the group from dirnam, and create a result vector
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
875 ready to be added to the list of search results."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
876
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
877 ;; remove nnir-*-remove-prefix from beginning of dirnam filename
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
878 (when (string-match (concat "^" prefix) dirnam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
879 (setq dirnam (replace-match "" t t dirnam)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
880
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
881 (when (file-readable-p (concat prefix dirnam article))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
882 ;; remove trailing slash and, for nnmaildir, cur/new/tmp
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
883 (setq dirnam
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
884 (substring dirnam 0 (if (string= server "nnmaildir:") -5 -1)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
885
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
886 ;; Set group to dirnam without any leading dots or slashes,
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
887 ;; and with all subsequent slashes replaced by dots
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
888 (let ((group (gnus-replace-in-string
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
889 (gnus-replace-in-string dirnam "^[./\\]" "" t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
890 "[/\\]" "." t)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
891
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
892 (vector (nnir-group-full-name group server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
893 (if (string= server "nnmaildir:")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
894 (nnmaildir-base-name-to-article-number
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
895 (substring article 0 (string-match ":" article))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
896 group nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
897 (string-to-number article))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
898 (string-to-number score)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
899
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
900 ;;; Search Engine Interfaces:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
901
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
902 ;; freeWAIS-sf interface.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
903 (defun nnir-run-waissearch (query server &optional group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
904 "Run given query agains waissearch. Returns vector of (group name, file name)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
905 pairs (also vectors, actually)."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
906 (when group
105167
e14dfafc8256 * gnus-art.el (gnus-article-encrypt-body):
Juanma Barranquero <lekktu@gmail.com>
parents: 104700
diff changeset
907 (error "The freeWAIS-sf backend cannot search specific groups"))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
908 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
909 (let ((qstring (cdr (assq 'query query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
910 (prefix (nnir-read-server-parm 'nnir-wais-remove-prefix server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
911 artlist score artno dirnam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
912 (set-buffer (get-buffer-create nnir-tmp-buffer))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
913 (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
914 (message "Doing WAIS query %s..." query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
915 (call-process nnir-wais-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
916 nil ; input from /dev/null
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
917 t ; output to current buffer
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
918 nil ; don't redisplay
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
919 "-d" (nnir-read-server-parm 'nnir-wais-database server) ; database to search
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
920 qstring)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
921 (message "Massaging waissearch output...")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
922 ;; remove superfluous lines
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
923 (keep-lines "Score:")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
924 ;; extract data from result lines
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
925 (goto-char (point-min))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
926 (while (re-search-forward
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
927 "Score: +\\([0-9]+\\).*'\\([0-9]+\\) +\\([^']+\\)/'" nil t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
928 (setq score (match-string 1)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
929 artno (match-string 2)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
930 dirnam (match-string 3))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
931 (unless (string-match prefix dirnam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
932 (nnheader-report 'nnir "Dir name %s doesn't contain prefix %s"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
933 dirnam prefix))
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
934 (setq group (gnus-replace-in-string
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
935 (replace-match "" t t dirnam) "/" "."))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
936 (push (vector (nnir-group-full-name group server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
937 (string-to-number artno)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
938 (string-to-number score))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
939 artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
940 (message "Massaging waissearch output...done")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
941 (apply 'vector
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
942 (sort artlist
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
943 (function (lambda (x y)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
944 (> (nnir-artitem-rsv x)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
945 (nnir-artitem-rsv y)))))))))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
946
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
947 ;; IMAP interface.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
948 ;; todo:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
949 ;; nnir invokes this two (2) times???!
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
950 ;; we should not use nnimap at all but open our own server connection
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
951 ;; we should not LIST * but use nnimap-list-pattern from defs
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
952 ;; send queries as literals
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
953 ;; handle errors
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
954
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
955 (autoload 'nnimap-open-server "nnimap")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
956 (defvar nnimap-server-buffer) ;; nnimap.el
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
957 (autoload 'imap-mailbox-select "imap")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
958 (autoload 'imap-search "imap")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
959 (autoload 'imap-quote-specials "imap")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
960
110517
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
961 (eval-when-compile
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
962 (autoload 'nnimap-buffer "nnimap")
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
963 (autoload 'nnimap-command "nnimap")
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
964 (autoload 'nnimap-possibly-change-group "nnimap"))
64945cefe6a6 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110516
diff changeset
965
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
966 (defun nnir-run-imap (query srv &optional group-option)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
967 "Run a search against an IMAP back-end server.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
968 This uses a custom query language parser; see `nnir-imap-make-query' for
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
969 details on the language and supported extensions"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
970 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
971 (let ((qstring (cdr (assq 'query query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
972 (server (cadr (gnus-server-to-method srv)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
973 (group (or group-option (gnus-group-group-name)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
974 (defs (caddr (gnus-server-to-method srv)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
975 (criteria (or (cdr (assq 'criteria query))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
976 nnir-imap-search-field))
110516
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
977 (gnus-inhibit-demon t)
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
978 artlist)
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
979 (message "Opening server %s" server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
980 (condition-case ()
110516
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
981 (when (nnimap-possibly-change-group (gnus-group-short-name group) server)
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
982 (with-current-buffer (nnimap-buffer)
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
983 (message "Searching %s..." group)
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
984 (let ((arts 0)
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
985 (result
110569
5e158658b471 nnir.el (nnir-run-imap): Allow sending IMAP search patterns directly.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110517
diff changeset
986 (nnimap-command "UID SEARCH %s"
5e158658b471 nnir.el (nnir-run-imap): Allow sending IMAP search patterns directly.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110517
diff changeset
987 (if (string= criteria "")
5e158658b471 nnir.el (nnir-run-imap): Allow sending IMAP search patterns directly.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110517
diff changeset
988 qstring
5e158658b471 nnir.el (nnir-run-imap): Allow sending IMAP search patterns directly.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110517
diff changeset
989 (nnir-imap-make-query criteria qstring)
5e158658b471 nnir.el (nnir-run-imap): Allow sending IMAP search patterns directly.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110517
diff changeset
990 ))))
110516
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
991 (mapc
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
992 (lambda (artnum)
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
993 (push (vector group artnum 1) artlist)
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
994 (setq arts (1+ arts)))
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
995 (and (car result)
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
996 (delete 0 (mapcar #'string-to-number
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
997 (cdr (assoc "SEARCH" (cdr result)))))))
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
998 (message "Searching %s... %d matches" group arts)))
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
999 (message "Searching %s...done" group))
4d2f8b81bb01 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110475
diff changeset
1000 (quit nil))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1001 (reverse artlist))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1002
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1003 (defun nnir-imap-make-query (criteria qstring)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1004 "Parse the query string and criteria into an appropriate IMAP search
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1005 expression, returning the string query to make.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1006
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1007 This implements a little language designed to return the expected results
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1008 to an arbitrary query string to the end user.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1009
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1010 The search is always case-insensitive, as defined by RFC2060, and supports
95616
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
1011 the following features (inspired by the Google search input language):
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1012
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1013 Automatic \"and\" queries
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1014 If you specify multiple words then they will be treated as an \"and\"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1015 expression intended to match all components.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1016
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1017 Phrase searches
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1018 If you wrap your query in double-quotes then it will be treated as a
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1019 literal string.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1020
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1021 Negative terms
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1022 If you precede a term with \"-\" then it will negate that.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1023
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1024 \"OR\" queries
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1025 If you include an upper-case \"OR\" in your search it will cause the
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1026 term before it and the term after it to be treated as alternatives.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1027
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1028 In future the following will be added to the language:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1029 * support for date matches
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1030 * support for location of text matching within the query
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1031 * from/to/etc headers
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1032 * additional search terms
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1033 * flag based searching
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1034 * anything else that the RFC supports, basically."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1035 ;; Walk through the query and turn it into an IMAP query string.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1036 (nnir-imap-query-to-imap criteria (nnir-imap-parse-query qstring)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1037
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1038
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1039 (defun nnir-imap-query-to-imap (criteria query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1040 "Turn a s-expression format query into IMAP."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1041 (mapconcat
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1042 ;; Turn the expressions into IMAP text
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1043 (lambda (item)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1044 (nnir-imap-expr-to-imap criteria item))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1045 ;; The query, already in s-expr format.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1046 query
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1047 ;; Append a space between each expression
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1048 " "))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1049
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1050
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1051 (defun nnir-imap-expr-to-imap (criteria expr)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1052 "Convert EXPR into an IMAP search expression on CRITERIA"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1053 ;; What sort of expression is this, eh?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1054 (cond
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1055 ;; Simple string term
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1056 ((stringp expr)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1057 (format "%s \"%s\"" criteria (imap-quote-specials expr)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1058 ;; Trivial term: and
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1059 ((eq expr 'and) nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1060 ;; Composite term: or expression
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1061 ((eq (car-safe expr) 'or)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1062 (format "OR %s %s"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1063 (nnir-imap-expr-to-imap criteria (second expr))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1064 (nnir-imap-expr-to-imap criteria (third expr))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1065 ;; Composite term: just the fax, mam
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1066 ((eq (car-safe expr) 'not)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1067 (format "NOT (%s)" (nnir-imap-query-to-imap criteria (rest expr))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1068 ;; Composite term: just expand it all.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1069 ((and (not (null expr)) (listp expr))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1070 (format "(%s)" (nnir-imap-query-to-imap criteria expr)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1071 ;; Complex value, give up for now.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1072 (t (error "Unhandled input: %S" expr))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1073
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1074
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1075 (defun nnir-imap-parse-query (string)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1076 "Turn STRING into an s-expression based query based on the IMAP
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1077 query language as defined in `nnir-imap-make-query'.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1078
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1079 This involves turning individual tokens into higher level terms
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1080 that the search language can then understand and use."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1081 (with-temp-buffer
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1082 ;; Set up the parsing environment.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1083 (insert string)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1084 (goto-char (point-min))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1085 ;; Now, collect the output terms and return them.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1086 (let (out)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1087 (while (not (nnir-imap-end-of-input))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1088 (push (nnir-imap-next-expr) out))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1089 (reverse out))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1090
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1091
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1092 (defun nnir-imap-next-expr (&optional count)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1093 "Return the next expression from the current buffer."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1094 (let ((term (nnir-imap-next-term count))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1095 (next (nnir-imap-peek-symbol)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1096 ;; Are we looking at an 'or' expression?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1097 (cond
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1098 ;; Handle 'expr or expr'
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1099 ((eq next 'or)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1100 (list 'or term (nnir-imap-next-expr 2)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1101 ;; Anything else
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1102 (t term))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1103
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1104
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1105 (defun nnir-imap-next-term (&optional count)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1106 "Return the next TERM from the current buffer."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1107 (let ((term (nnir-imap-next-symbol count)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1108 ;; What sort of term is this?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1109 (cond
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1110 ;; and -- just ignore it
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1111 ((eq term 'and) 'and)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1112 ;; negated term
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1113 ((eq term 'not) (list 'not (nnir-imap-next-expr)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1114 ;; generic term
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1115 (t term))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1116
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1117
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1118 (defun nnir-imap-peek-symbol ()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1119 "Return the next symbol from the current buffer, but don't consume it."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1120 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1121 (nnir-imap-next-symbol)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1122
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1123 (defun nnir-imap-next-symbol (&optional count)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1124 "Return the next symbol from the current buffer, or nil if we are
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1125 at the end of the buffer. If supplied COUNT skips some symbols before
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1126 returning the one at the supplied position."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1127 (when (and (numberp count) (> count 1))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1128 (nnir-imap-next-symbol (1- count)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1129 (let ((case-fold-search t))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1130 ;; end of input stream?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1131 (unless (nnir-imap-end-of-input)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1132 ;; No, return the next symbol from the stream.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1133 (cond
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1134 ;; negated expression -- return it and advance one char.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1135 ((looking-at "-") (forward-char 1) 'not)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1136 ;; quoted string
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1137 ((looking-at "\"") (nnir-imap-delimited-string "\""))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1138 ;; list expression -- we parse the content and return this as a list.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1139 ((looking-at "(")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1140 (nnir-imap-parse-query (nnir-imap-delimited-string ")")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1141 ;; keyword input -- return a symbol version
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1142 ((looking-at "\\band\\b") (forward-char 3) 'and)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1143 ((looking-at "\\bor\\b") (forward-char 2) 'or)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1144 ((looking-at "\\bnot\\b") (forward-char 3) 'not)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1145 ;; Simple, boring keyword
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1146 (t (let ((start (point))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1147 (end (if (search-forward-regexp "[[:blank:]]" nil t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1148 (prog1
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1149 (match-beginning 0)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1150 ;; unskip if we hit a non-blank terminal character.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1151 (when (string-match "[^[:blank:]]" (match-string 0))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1152 (backward-char 1)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1153 (goto-char (point-max)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1154 (buffer-substring start end)))))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1155
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1156 (defun nnir-imap-delimited-string (delimiter)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1157 "Return a delimited string from the current buffer."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1158 (let ((start (point)) end)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1159 (forward-char 1) ; skip the first delimiter.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1160 (while (not end)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1161 (unless (search-forward delimiter nil t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1162 (error "Unmatched delimited input with %s in query" delimiter))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1163 (let ((here (point)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1164 (unless (equal (buffer-substring (- here 2) (- here 1)) "\\")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1165 (setq end (point)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1166 (buffer-substring (1+ start) (1- end))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1167
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1168 (defun nnir-imap-end-of-input ()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1169 "Are we at the end of input?"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1170 (skip-chars-forward "[[:blank:]]")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1171 (looking-at "$"))
95616
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
1172
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1173
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1174 ;; Swish++ interface.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1175 ;; -cc- Todo
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1176 ;; Search by
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1177 ;; - group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1178 ;; Sort by
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1179 ;; - rank (default)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1180 ;; - article number
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1181 ;; - file size
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1182 ;; - group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1183 (defun nnir-run-swish++ (query server &optional group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1184 "Run QUERY against swish++.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1185 Returns a vector of (group name, file name) pairs (also vectors,
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1186 actually).
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1187
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1188 Tested with swish++ 4.7 on GNU/Linux and with swish++ 5.0b2 on
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1189 Windows NT 4.0."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1190
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1191 (when group
105167
e14dfafc8256 * gnus-art.el (gnus-article-encrypt-body):
Juanma Barranquero <lekktu@gmail.com>
parents: 104700
diff changeset
1192 (error "The swish++ backend cannot search specific groups"))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1193
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1194 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1195 (let ( (qstring (cdr (assq 'query query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1196 (groupspec (cdr (assq 'group query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1197 (prefix (nnir-read-server-parm 'nnir-swish++-remove-prefix server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1198 artlist
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1199 ;; nnml-use-compressed-files might be any string, but probably this
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1200 ;; is sufficient. Note that we can't only use the value of
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1201 ;; nnml-use-compressed-files because old articles might have been
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1202 ;; saved with a different value.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1203 (article-pattern (if (string= server "nnmaildir:")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1204 ":[0-9]+"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1205 "^[0-9]+\\(\\.[a-z0-9]+\\)?$"))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1206 score artno dirnam filenam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1207
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1208 (when (equal "" qstring)
105167
e14dfafc8256 * gnus-art.el (gnus-article-encrypt-body):
Juanma Barranquero <lekktu@gmail.com>
parents: 104700
diff changeset
1209 (error "swish++: You didn't enter anything"))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1210
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1211 (set-buffer (get-buffer-create nnir-tmp-buffer))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1212 (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1213
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1214 (if groupspec
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1215 (message "Doing swish++ query %s on %s..." qstring groupspec)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1216 (message "Doing swish++ query %s..." qstring))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1217
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1218 (let* ((cp-list `( ,nnir-swish++-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1219 nil ; input from /dev/null
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1220 t ; output
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1221 nil ; don't redisplay
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1222 "--config-file" ,(nnir-read-server-parm 'nnir-swish++-configuration-file server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1223 ,@(nnir-read-server-parm 'nnir-swish++-additional-switches server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1224 ,qstring ; the query, in swish++ format
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1225 ))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1226 (exitstatus
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1227 (progn
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1228 (message "%s args: %s" nnir-swish++-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1229 (mapconcat 'identity (cddddr cp-list) " ")) ;; ???
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1230 (apply 'call-process cp-list))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1231 (unless (or (null exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1232 (zerop exitstatus))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1233 (nnheader-report 'nnir "Couldn't run swish++: %s" exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1234 ;; swish++ failure reason is in this buffer, show it if
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1235 ;; the user wants it.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1236 (when (> gnus-verbose 6)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1237 (display-buffer nnir-tmp-buffer))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1238
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1239 ;; The results are output in the format of:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1240 ;; V 4.7 Linux
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1241 ;; rank relative-path-name file-size file-title
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1242 ;; V 5.0b2:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1243 ;; rank relative-path-name file-size topic??
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1244 ;; where rank is an integer from 1 to 100.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1245 (goto-char (point-min))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1246 (while (re-search-forward
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1247 "\\(^[0-9]+\\) \\([^ ]+\\) [0-9]+ \\(.*\\)$" nil t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1248 (setq score (match-string 1)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1249 filenam (match-string 2)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1250 artno (file-name-nondirectory filenam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1251 dirnam (file-name-directory filenam))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1252
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1253 ;; don't match directories
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1254 (when (string-match article-pattern artno)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1255 (when (not (null dirnam))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1256
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1257 ;; maybe limit results to matching groups.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1258 (when (or (not groupspec)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1259 (string-match groupspec dirnam))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1260 (nnir-add-result dirnam artno score prefix server artlist)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1261
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1262 (message "Massaging swish++ output...done")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1263
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1264 ;; Sort by score
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1265 (apply 'vector
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1266 (sort artlist
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1267 (function (lambda (x y)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1268 (> (nnir-artitem-rsv x)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1269 (nnir-artitem-rsv y)))))))))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1270
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1271 ;; Swish-E interface.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1272 (defun nnir-run-swish-e (query server &optional group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1273 "Run given query against swish-e.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1274 Returns a vector of (group name, file name) pairs (also vectors,
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1275 actually).
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1276
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1277 Tested with swish-e-2.0.1 on Windows NT 4.0."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1278
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1279 ;; swish-e crashes with empty parameter to "-w" on commandline...
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1280 (when group
105167
e14dfafc8256 * gnus-art.el (gnus-article-encrypt-body):
Juanma Barranquero <lekktu@gmail.com>
parents: 104700
diff changeset
1281 (error "The swish-e backend cannot search specific groups"))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1282
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1283 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1284 (let ((qstring (cdr (assq 'query query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1285 (prefix
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1286 (or (nnir-read-server-parm 'nnir-swish-e-remove-prefix server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1287 (error "Missing parameter `nnir-swish-e-remove-prefix'")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1288 artlist score artno dirnam group )
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1289
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1290 (when (equal "" qstring)
105167
e14dfafc8256 * gnus-art.el (gnus-article-encrypt-body):
Juanma Barranquero <lekktu@gmail.com>
parents: 104700
diff changeset
1291 (error "swish-e: You didn't enter anything"))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1292
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1293 (set-buffer (get-buffer-create nnir-tmp-buffer))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1294 (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1295
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1296 (message "Doing swish-e query %s..." query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1297 (let* ((index-files
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1298 (or (nnir-read-server-parm
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1299 'nnir-swish-e-index-files server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1300 (error "Missing parameter `nnir-swish-e-index-files'")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1301 (additional-switches
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1302 (nnir-read-server-parm
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1303 'nnir-swish-e-additional-switches server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1304 (cp-list `(,nnir-swish-e-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1305 nil ; input from /dev/null
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1306 t ; output
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1307 nil ; don't redisplay
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1308 "-f" ,@index-files
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1309 ,@additional-switches
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1310 "-w"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1311 ,qstring ; the query, in swish-e format
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1312 ))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1313 (exitstatus
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1314 (progn
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1315 (message "%s args: %s" nnir-swish-e-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1316 (mapconcat 'identity (cddddr cp-list) " "))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1317 (apply 'call-process cp-list))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1318 (unless (or (null exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1319 (zerop exitstatus))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1320 (nnheader-report 'nnir "Couldn't run swish-e: %s" exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1321 ;; swish-e failure reason is in this buffer, show it if
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1322 ;; the user wants it.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1323 (when (> gnus-verbose 6)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1324 (display-buffer nnir-tmp-buffer))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1325
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1326 ;; The results are output in the format of:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1327 ;; rank path-name file-title file-size
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1328 (goto-char (point-min))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1329 (while (re-search-forward
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1330 "\\(^[0-9]+\\) \\([^ ]+\\) \"\\([^\"]+\\)\" [0-9]+$" nil t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1331 (setq score (match-string 1)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1332 artno (match-string 3)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1333 dirnam (file-name-directory (match-string 2)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1334
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1335 ;; don't match directories
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1336 (when (string-match "^[0-9]+$" artno)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1337 (when (not (null dirnam))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1338
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1339 ;; remove nnir-swish-e-remove-prefix from beginning of dirname
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1340 (when (string-match (concat "^" prefix) dirnam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1341 (setq dirnam (replace-match "" t t dirnam)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1342
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1343 (setq dirnam (substring dirnam 0 -1))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1344 ;; eliminate all ".", "/", "\" from beginning. Always matches.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1345 (string-match "^[./\\]*\\(.*\\)$" dirnam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1346 ;; "/" -> "."
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1347 (setq group (gnus-replace-in-string (match-string 1 dirnam) "/" "."))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1348 ;; Windows "\\" -> "."
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1349 (setq group (gnus-replace-in-string group "\\\\" "."))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1350
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1351 (push (vector (nnir-group-full-name group server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1352 (string-to-number artno)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1353 (string-to-number score))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1354 artlist))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1355
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1356 (message "Massaging swish-e output...done")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1357
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1358 ;; Sort by score
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1359 (apply 'vector
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1360 (sort artlist
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1361 (function (lambda (x y)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1362 (> (nnir-artitem-rsv x)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1363 (nnir-artitem-rsv y)))))))))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1364
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1365 ;; HyREX interface
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1366 (defun nnir-run-hyrex (query server &optional group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1367 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1368 (let ((artlist nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1369 (groupspec (cdr (assq 'group query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1370 (qstring (cdr (assq 'query query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1371 (prefix (nnir-read-server-parm 'nnir-hyrex-remove-prefix server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1372 score artno dirnam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1373 (when (and group groupspec)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1374 (error (concat "It does not make sense to use a group spec"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1375 " with process-marked groups.")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1376 (when group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1377 (setq groupspec (gnus-group-real-name group)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1378 (when (and group (not (equal group (nnir-group-full-name groupspec server))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1379 (message "%s vs. %s" group (nnir-group-full-name groupspec server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1380 (error "Server with groupspec doesn't match group !"))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1381 (set-buffer (get-buffer-create nnir-tmp-buffer))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1382 (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1383 (if groupspec
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1384 (message "Doing hyrex-search query %s on %s..." query groupspec)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1385 (message "Doing hyrex-search query %s..." query))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1386 (let* ((cp-list
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1387 `( ,nnir-hyrex-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1388 nil ; input from /dev/null
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1389 t ; output
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1390 nil ; don't redisplay
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1391 "-i",(nnir-read-server-parm 'nnir-hyrex-index-directory server) ; index directory
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1392 ,@(nnir-read-server-parm 'nnir-hyrex-additional-switches server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1393 ,qstring ; the query, in hyrex-search format
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1394 ))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1395 (exitstatus
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1396 (progn
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1397 (message "%s args: %s" nnir-hyrex-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1398 (mapconcat 'identity (cddddr cp-list) " "))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1399 (apply 'call-process cp-list))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1400 (unless (or (null exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1401 (zerop exitstatus))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1402 (nnheader-report 'nnir "Couldn't run hyrex-search: %s" exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1403 ;; nnir-search failure reason is in this buffer, show it if
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1404 ;; the user wants it.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1405 (when (> gnus-verbose 6)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1406 (display-buffer nnir-tmp-buffer)))) ;; FIXME: Dont clear buffer !
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1407 (if groupspec
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1408 (message "Doing hyrex-search query \"%s\" on %s...done" qstring groupspec)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1409 (message "Doing hyrex-search query \"%s\"...done" qstring))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1410 (sit-for 0)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1411 ;; nnir-search returns:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1412 ;; for nnml/nnfolder: "filename mailid weigth"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1413 ;; for nnimap: "group mailid weigth"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1414 (goto-char (point-min))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1415 (delete-non-matching-lines "^\\S + [0-9]+ [0-9]+$")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1416 ;; HyREX couldn't search directly in groups -- so filter out here.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1417 (when groupspec
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1418 (keep-lines groupspec))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1419 ;; extract data from result lines
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1420 (goto-char (point-min))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1421 (while (re-search-forward
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1422 "\\(\\S +\\) \\([0-9]+\\) \\([0-9]+\\)" nil t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1423 (setq dirnam (match-string 1)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1424 artno (match-string 2)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1425 score (match-string 3))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1426 (when (string-match prefix dirnam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1427 (setq dirnam (replace-match "" t t dirnam)))
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1428 (push (vector (nnir-group-full-name
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1429 (gnus-replace-in-string dirnam "/" ".") server)
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1430 (string-to-number artno)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1431 (string-to-number score))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1432 artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1433 (message "Massaging hyrex-search output...done.")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1434 (apply 'vector
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1435 (sort artlist
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1436 (function (lambda (x y)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1437 (if (string-lessp (nnir-artitem-group x)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1438 (nnir-artitem-group y))
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1439 t
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1440 (< (nnir-artitem-number x)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1441 (nnir-artitem-number y)))))))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1442 )))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1443
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1444 ;; Namazu interface
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1445 (defun nnir-run-namazu (query server &optional group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1446 "Run given query against Namazu. Returns a vector of (group name, file name)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1447 pairs (also vectors, actually).
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1448
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1449 Tested with Namazu 2.0.6 on a GNU/Linux system."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1450 (when group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1451 (error "The Namazu backend cannot search specific groups"))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1452 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1453 (let ((article-pattern (if (string= server "nnmaildir:")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1454 ":[0-9]+"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1455 "^[0-9]+$"))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1456 artlist
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1457 (qstring (cdr (assq 'query query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1458 (prefix (nnir-read-server-parm 'nnir-namazu-remove-prefix server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1459 score group article
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1460 (process-environment (copy-sequence process-environment)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1461 (setenv "LC_MESSAGES" "C")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1462 (set-buffer (get-buffer-create nnir-tmp-buffer))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1463 (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1464 (let* ((cp-list
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1465 `( ,nnir-namazu-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1466 nil ; input from /dev/null
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1467 t ; output
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1468 nil ; don't redisplay
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1469 "-q" ; don't be verbose
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1470 "-a" ; show all matches
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1471 "-s" ; use short format
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1472 ,@(nnir-read-server-parm 'nnir-namazu-additional-switches server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1473 ,qstring ; the query, in namazu format
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1474 ,(nnir-read-server-parm 'nnir-namazu-index-directory server) ; index directory
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1475 ))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1476 (exitstatus
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1477 (progn
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1478 (message "%s args: %s" nnir-namazu-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1479 (mapconcat 'identity (cddddr cp-list) " "))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1480 (apply 'call-process cp-list))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1481 (unless (or (null exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1482 (zerop exitstatus))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1483 (nnheader-report 'nnir "Couldn't run namazu: %s" exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1484 ;; Namazu failure reason is in this buffer, show it if
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1485 ;; the user wants it.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1486 (when (> gnus-verbose 6)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1487 (display-buffer nnir-tmp-buffer))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1488
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1489 ;; Namazu output looks something like this:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1490 ;; 2. Re: Gnus agent expire broken (score: 55)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1491 ;; /home/henrik/Mail/mail/sent/1310 (4,138 bytes)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1492
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1493 (goto-char (point-min))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1494 (while (re-search-forward
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1495 "^\\([0-9]+\\.\\).*\\((score: \\([0-9]+\\)\\))\n\\([^ ]+\\)"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1496 nil t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1497 (setq score (match-string 3)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1498 group (file-name-directory (match-string 4))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1499 article (file-name-nondirectory (match-string 4)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1500
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1501 ;; make sure article and group is sane
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1502 (when (and (string-match article-pattern article)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1503 (not (null group)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1504 (nnir-add-result group article score prefix server artlist)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1505
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1506 ;; sort artlist by score
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1507 (apply 'vector
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1508 (sort artlist
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1509 (function (lambda (x y)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1510 (> (nnir-artitem-rsv x)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1511 (nnir-artitem-rsv y)))))))))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1512
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1513 (defun nnir-run-find-grep (query server &optional group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1514 "Run find and grep to obtain matching articles."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1515 (let* ((method (gnus-server-to-method server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1516 (sym (intern
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1517 (concat (symbol-name (car method)) "-directory")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1518 (directory (cadr (assoc sym (cddr method))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1519 (regexp (cdr (assoc 'query query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1520 (grep-options (cdr (assoc 'grep-options query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1521 artlist)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1522 (unless directory
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1523 (error "No directory found in method specification of server %s"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1524 server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1525 (message "Searching %s using find-grep..." (or group server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1526 (save-window-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1527 (set-buffer (get-buffer-create nnir-tmp-buffer))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1528 (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1529 (if (> gnus-verbose 6)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1530 (pop-to-buffer (current-buffer)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1531 (cd directory) ; Using relative paths simplifies postprocessing.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1532 (let ((group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1533 (if (not group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1534 "."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1535 ;; Try accessing the group literally as well as
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1536 ;; interpreting dots as directory separators so the
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1537 ;; engine works with plain nnml as well as the Gnus Cache.
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1538 (let ((group (gnus-group-real-name group)))
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1539 ;; Replace cl-func find-if.
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1540 (if (file-directory-p group)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1541 group
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1542 (if (file-directory-p
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1543 (setq group (gnus-replace-in-string group "\\." "/" t)))
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1544 group))))))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1545 (unless group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1546 (error "Cannot locate directory for group"))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1547 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1548 (apply
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1549 'call-process "find" nil t
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1550 "find" group "-type" "f" "-name" "[0-9]*" "-exec"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1551 "grep"
95830
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
1552 `("-l" ,@(and grep-options
110475
ab3a38ccb842 Remove Emacs 21 stuff.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110422
diff changeset
1553 (split-string grep-options "\\s-" t))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1554 "-e" ,regexp "{}" "+"))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1555
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1556 ;; Translate relative paths to group names.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1557 (while (not (eobp))
110475
ab3a38ccb842 Remove Emacs 21 stuff.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110422
diff changeset
1558 (let* ((path (split-string
ab3a38ccb842 Remove Emacs 21 stuff.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110422
diff changeset
1559 (buffer-substring (point) (line-end-position)) "/" t))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1560 (art (string-to-number (car (last path)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1561 (while (string= "." (car path))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1562 (setq path (cdr path)))
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1563 (let ((group (mapconcat 'identity
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1564 ;; Replace cl-func: (subseq path 0 -1)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1565 (let ((end (1- (length path)))
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1566 res)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1567 (while (>= (setq end (1- end)) 0)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1568 (push (pop path) res))
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1569 (nreverse res))
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1570 ".")))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1571 (push (vector (nnir-group-full-name group server) art 0)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1572 artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1573 (forward-line 1)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1574 (message "Searching %s using find-grep...done" (or group server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1575 artlist)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1576
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1577 ;;; Util Code:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1578
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1579 (defun nnir-read-parms (query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1580 "Reads additional search parameters according to `nnir-engines'."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1581 (let ((parmspec (caddr (assoc nnir-search-engine nnir-engines))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1582 (cons (cons 'query query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1583 (mapcar 'nnir-read-parm parmspec))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1584
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1585 (defun nnir-read-parm (parmspec)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1586 "Reads a single search parameter.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1587 `parmspec' is a cons cell, the car is a symbol, the cdr is a prompt."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1588 (let ((sym (car parmspec))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1589 (prompt (cdr parmspec)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1590 (if (listp prompt)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1591 (let* ((result (apply 'completing-read prompt))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1592 (mapping (or (assoc result nnir-imap-search-arguments)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1593 (assoc nil nnir-imap-search-arguments))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1594 (cons sym (format (cdr mapping) result)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1595 (cons sym (read-string prompt)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1596
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1597 (defun nnir-run-query (query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1598 "Invoke appropriate search engine function (see `nnir-engines').
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1599 If some groups were process-marked, run the query for each of the groups
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1600 and concat the results."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1601 (let ((q (car (read-from-string query))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1602 (if gnus-group-marked
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1603 (apply 'vconcat
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1604 (mapcar (lambda (x)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1605 (let ((server (nnir-group-server x))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1606 search-func)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1607 (setq search-func (cadr
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1608 (assoc
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1609 (nnir-read-server-parm 'nnir-search-engine server) nnir-engines)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1610 (if search-func
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1611 (funcall search-func q server x)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1612 nil)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1613 gnus-group-marked)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1614 )
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1615 (apply 'vconcat
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1616 (mapcar (lambda (x)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1617 (if (and (equal (cadr x) 'ok) (not (equal (cadar x) "-ephemeral")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1618 (let ((server (format "%s:%s" (caar x) (cadar x)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1619 search-func)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1620 (setq search-func (cadr
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1621 (assoc
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1622 (nnir-read-server-parm 'nnir-search-engine server) nnir-engines)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1623 (if search-func
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1624 (funcall search-func q server nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1625 nil))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1626 nil))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1627 gnus-opened-servers)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1628 ))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1629 ))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1630
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1631 (defun nnir-read-server-parm (key server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1632 "Returns the parameter value of for the given server, where server is of
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1633 form 'backend:name'."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1634 (let ((method (gnus-server-to-method server)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1635 (cond ((and method (assq key (cddr method)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1636 (nth 1 (assq key (cddr method))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1637 ((and nnir-mail-backend
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1638 (gnus-server-equal method nnir-mail-backend))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1639 (symbol-value key))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1640 (t nil))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1641 ;; (if method
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1642 ;; (if (assq key (cddr method))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1643 ;; (nth 1 (assq key (cddr method)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1644 ;; (symbol-value key))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1645 ;; (symbol-value key))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1646 ;; ))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1647
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1648 (defun nnir-group-full-name (shortname server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1649 "For the given group name, return a full Gnus group name.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1650 The Gnus backend/server information is added."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1651 (gnus-group-prefixed-name shortname (gnus-server-to-method server)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1652
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1653 (defun nnir-possibly-change-server (server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1654 (unless (and server (nnir-server-opened server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1655 (nnir-open-server server)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1656
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1657
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1658 ;; Data type article list.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1659
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1660 (defun nnir-artlist-length (artlist)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1661 "Returns number of articles in artlist."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1662 (length artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1663
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1664 (defun nnir-artlist-article (artlist n)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1665 "Returns from ARTLIST the Nth artitem (counting starting at 1)."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1666 (elt artlist (1- n)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1667
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1668 (defun nnir-artitem-group (artitem)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1669 "Returns the group from the ARTITEM."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1670 (elt artitem 0))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1671
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1672 (defun nnir-artlist-artitem-group (artlist n)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1673 "Returns from ARTLIST the group of the Nth artitem (counting from 1)."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1674 (nnir-artitem-group (nnir-artlist-article artlist n)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1675
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1676 (defun nnir-artitem-number (artitem)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1677 "Returns the number from the ARTITEM."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1678 (elt artitem 1))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1679
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1680 (defun nnir-artlist-artitem-number (artlist n)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1681 "Returns from ARTLIST the number of the Nth artitem (counting from 1)."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1682 (nnir-artitem-number (nnir-artlist-article artlist n)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1683
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1684 (defun nnir-artitem-rsv (artitem)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1685 "Returns the Retrieval Status Value (RSV, score) from the ARTITEM."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1686 (elt artitem 2))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1687
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1688 (defun nnir-artlist-artitem-rsv (artlist n)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1689 "Returns from ARTLIST the Retrieval Status Value of the Nth artitem
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1690 \(counting from 1)."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1691 (nnir-artitem-rsv (nnir-artlist-article artlist n)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1692
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1693 ;; unused?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1694 (defun nnir-artlist-groups (artlist)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1695 "Returns a list of all groups in the given ARTLIST."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1696 (let ((res nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1697 (with-dups nil))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1698 ;; from each artitem, extract group component
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1699 (setq with-dups (mapcar 'nnir-artitem-group artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1700 ;; remove duplicates from above
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1701 (mapc (function (lambda (x) (add-to-list 'res x)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1702 with-dups)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1703 res))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1704
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1705
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1706 ;; The end.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1707 (provide 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1708
95616
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
1709 ;;; nnir.el ends here