annotate lisp/gnus/nnir.el @ 109825:a2dc02f10ab3

Use CLIPBOARD and PRIMARY on NS (Bug#6677). * lisp/term/ns-win.el (ns-get-pasteboard, ns-set-pasteboard): Use QCLIPBOARD instead of QPRIMARY (Bug#6677). * src/nsselect.m (QCLIPBOARD, NXPrimaryPboard): Define. (symbol_to_nsstring): Map QCLIPBOARD => NSGeneralPboard, QPRIMARY => NXPrimaryPboard. (ns_string_to_symbol): NSGeneralPboard => QCLIPBOARD, NXPrimaryPboard => QPRIMARY. (nxatoms_of_nsselect): NXPrimaryPboard = PrimarySelection, NXSecondaryPboard = SecondarySelection. (syms_of_nsselect): Intern QCLIPBOARD (Bug#6677).
author Jan D <jan.h.d@swipnet.se>
date Wed, 18 Aug 2010 08:16:55 +0200
parents c168d4537385
children 8f51744211eb
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'
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
266 ;; or `nnkiboze' backends: given a specification of what articles to
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
267 ;; show from another backend, it creates a group containing exactly
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
268 ;; those articles. The lower layer issues a query to a search engine
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
269 ;; and produces such a specification of what articles to show from the
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"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
348 "The IMAP search item when doing an nnir search")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
349
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
350 (defvar nnir-imap-search-arguments
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
351 '(("Whole message" . "TEXT")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
352 ("Subject" . "SUBJECT")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
353 ("To" . "TO")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
354 ("From" . "FROM")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
355 (nil . "HEADER \"%s\""))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
356 "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
357
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
358 (defvar nnir-imap-search-argument-history ()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
359 "The history for querying search options in nnir")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
360
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
361 (defvar nnir-get-article-nov-override-function nil
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
362 "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
363 should return a message's headers in NOV format.
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
364
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
365 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
366 result, `gnus-retrieve-headers' will be called instead.")
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
367
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
368
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
369 ;;; Developer Extension Variable:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
370
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
371 (defvar nnir-engines
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
372 `((wais nnir-run-waissearch
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
373 ())
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
374 (imap nnir-run-imap
95616
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
375 ((criteria
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
376 "Search in: " ; Prompt
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
377 ,nnir-imap-search-arguments ; alist for completing
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
378 nil ; no filtering
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
379 nil ; allow any user input
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
380 nil ; initial value
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
381 nnir-imap-search-argument-history ; the history to use
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
382 ,nnir-imap-search-field ; default
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
383 )))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
384 (swish++ nnir-run-swish++
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
385 ((group . "Group spec: ")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
386 (swish-e nnir-run-swish-e
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 (namazu nnir-run-namazu
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
389 ())
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
390 (hyrex nnir-run-hyrex
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
391 ((group . "Group spec: ")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
392 (find-grep nnir-run-find-grep
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
393 ((grep-options . "Grep options: "))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
394 "Alist of supported search engines.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
395 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
396 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
397 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
398 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
399 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
400
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
401 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
402 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
403 (setq nnir-search-engine 'wais)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
404 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
405 server supports searching:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
406 (setq nnir-search-engine 'imap)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
407 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
408 example, the `wais' backend needs the variables `nnir-wais-program',
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
409 `nnir-wais-database' and `nnir-wais-remove-prefix'.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
410
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
411 Add an entry here when adding a new search engine.")
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 ;;; User Customizable Variables:
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 (defgroup nnir nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
416 "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
417 :group 'gnus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
418
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
419 ;; Mail backend.
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 ;; TODO:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
422 ;; 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
423 ;;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
424 (defcustom nnir-mail-backend '(nnml "")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
425 "*Specifies which backend should be searched.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
426 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
427 messages found.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
428
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
429 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
430 something like the following:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
431 (setq nnir-mail-backend (nth 0 gnus-secondary-select-methods))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
432 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
433 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
434 at zero)."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
435 :type '(sexp)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
436 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
437
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
438 ;; Search engine to use.
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 (defcustom nnir-search-engine 'wais
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
441 "*The search engine to use. Must be a symbol.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
442 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
443 settings of `nnir-search-engine'."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
444 :type '(sexp)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
445 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
446
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
447 ;; freeWAIS-sf.
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 (defcustom nnir-wais-program "waissearch"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
450 "*Name of waissearch executable."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
451 :type '(string)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
452 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
453
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
454 (defcustom nnir-wais-database (expand-file-name "~/.wais/mail")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
455 "*Name of Wais database containing the mail.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
456
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
457 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
458 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
459 (setq nnir-wais-database \"/home/john/.wais/mail\")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
460 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
461 :type '(file)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
462 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
463
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
464 (defcustom nnir-wais-remove-prefix (concat (getenv "HOME") "/Mail/")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
465 "*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
466 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
467 regular expression.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
468
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
469 For example, suppose that Wais returns file names such as
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
470 \"/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
471 setting: (setq nnir-wais-remove-prefix \"/home/john/Mail/\")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
472 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
473 `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
474 arrive at the correct group name, \"mail.misc\"."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
475 :type '(regexp)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
476 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
477
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
478 (defcustom nnir-swish++-configuration-file
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
479 (expand-file-name "~/Mail/swish++.conf")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
480 "*Configuration file for swish++."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
481 :type '(file)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
482 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
483
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
484 (defcustom nnir-swish++-program "search"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
485 "*Name of swish++ search executable."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
486 :type '(string)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
487 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
488
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
489 (defcustom nnir-swish++-additional-switches '()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
490 "*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
491
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
492 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
493 (setq nnir-swish++-additional-switches \"-i -w\") ; wrong
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
494 Instead, use this:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
495 (setq nnir-swish++-additional-switches '(\"-i\" \"-w\"))"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
496 :type '(repeat (string))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
497 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
498
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
499 (defcustom nnir-swish++-remove-prefix (concat (getenv "HOME") "/Mail/")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
500 "*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
501 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
502 regular expression.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
503
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
504 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
505 that it is for swish++, not Wais."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
506 :type '(regexp)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
507 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
508
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
509 ;; Swish-E.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
510 ;; URL: http://sunsite.berkeley.edu/SWISH-E/
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
511 ;; New version: http://www.boe.es/swish-e
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
512 ;; 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
513 ;; `nnir-swish-e-additional-switches'
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
514
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
515 (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
516 'nnir-swish-e-index-files "Emacs 23.1")
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
517 (defcustom nnir-swish-e-index-file
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
518 (expand-file-name "~/Mail/index.swish-e")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
519 "*Index file for swish-e.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
520 This could be a server parameter.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
521 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
522 used instead, has been customized."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
523 :type '(file)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
524 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
525
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
526 (defcustom nnir-swish-e-index-files
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
527 (list nnir-swish-e-index-file)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
528 "*List of index files for swish-e.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
529 This could be a server parameter."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
530 :type '(repeat (file))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
531 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
532
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
533 (defcustom nnir-swish-e-program "swish-e"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
534 "*Name of swish-e search executable.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
535 This cannot be a server parameter."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
536 :type '(string)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
537 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
538
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
539 (defcustom nnir-swish-e-additional-switches '()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
540 "*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
541
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
542 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
543 (setq nnir-swish-e-additional-switches \"-i -w\") ; wrong
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
544 Instead, use this:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
545 (setq nnir-swish-e-additional-switches '(\"-i\" \"-w\"))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
546
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
547 This could be a server parameter."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
548 :type '(repeat (string))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
549 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
550
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
551 (defcustom nnir-swish-e-remove-prefix (concat (getenv "HOME") "/Mail/")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
552 "*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
553 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
554 regular expression.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
555
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
556 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
557 that it is for swish-e, not Wais.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
558
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
559 This could be a server parameter."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
560 :type '(regexp)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
561 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
562
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
563 ;; 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
564
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
565 (defcustom nnir-hyrex-program "nnir-search"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
566 "*Name of the nnir-search executable."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
567 :type '(string)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
568 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
569
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
570 (defcustom nnir-hyrex-additional-switches '()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
571 "*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
572 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
573 (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
574 Instead, use this:
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\"))"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
576 :type '(repeat (string))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
577 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
578
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
579 (defcustom nnir-hyrex-index-directory (getenv "HOME")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
580 "*Index directory for HyREX."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
581 :type '(directory)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
582 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
583
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
584 (defcustom nnir-hyrex-remove-prefix (concat (getenv "HOME") "/Mail/")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
585 "*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
586 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
587
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
588 For example, suppose that HyREX returns file names such as
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
589 \"/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
590 setting: (setq nnir-hyrex-remove-prefix \"/home/john/Mail/\")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
591 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
592 `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
593 arrive at the correct group name, \"mail.misc\"."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
594 :type '(directory)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
595 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
596
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
597 ;; Namazu engine, see <URL:http://ww.namazu.org/>
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 (defcustom nnir-namazu-program "namazu"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
600 "*Name of Namazu search executable."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
601 :type '(string)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
602 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
603
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
604 (defcustom nnir-namazu-index-directory (expand-file-name "~/Mail/namazu/")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
605 "*Index directory for Namazu."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
606 :type '(directory)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
607 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
608
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
609 (defcustom nnir-namazu-additional-switches '()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
610 "*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
611 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
612 make any sense in this context.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
613
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
614 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
615 (setq nnir-namazu-additional-switches \"-i -w\") ; wrong
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
616 Instead, use this:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
617 (setq nnir-namazu-additional-switches '(\"-i\" \"-w\"))"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
618 :type '(repeat (string))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
619 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
620
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
621 (defcustom nnir-namazu-remove-prefix (concat (getenv "HOME") "/Mail/")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
622 "*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
623 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
624
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
625 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
626 that it is for Namazu, not Wais."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
627 :type '(directory)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
628 :group 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
629
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
630 ;;; Internal Variables:
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 (defvar nnir-current-query nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
633 "Internal: stores current query (= group name).")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
634
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
635 (defvar nnir-current-server nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
636 "Internal: stores current server (does it ever change?).")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
637
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
638 (defvar nnir-current-group-marked nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
639 "Internal: stores current list of process-marked groups.")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
640
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
641 (defvar nnir-artlist nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
642 "Internal: stores search result.")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
643
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
644 (defvar nnir-tmp-buffer " *nnir*"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
645 "Internal: temporary buffer.")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
646
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
647 ;;; Code:
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 ;; Gnus glue.
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 (defun gnus-group-make-nnir-group (extra-parms query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
652 "Create an nnir group. Asks for query."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
653 (interactive "P\nsQuery: ")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
654 (setq nnir-current-query nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
655 nnir-current-server nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
656 nnir-current-group-marked nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
657 nnir-artlist nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
658 (let ((parms nil))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
659 (if extra-parms
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
660 (setq parms (nnir-read-parms query))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
661 (setq parms (list (cons 'query query))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
662 (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
663 (gnus-group-read-ephemeral-group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
664 (concat "nnir:" (prin1-to-string parms)) '(nnir "") t
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
665 (cons (current-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
666 gnus-current-window-configuration)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
667 nil)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
668
95830
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
669 (eval-when-compile
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
670 (when (featurep 'xemacs)
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
671 ;; 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
672 (require 'edmacro)))
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
673
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
674 (defun nnir-group-mode-hook ()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
675 (define-key gnus-group-mode-map (kbd "G G")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
676 'gnus-group-make-nnir-group))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
677 (add-hook 'gnus-group-mode-hook 'nnir-group-mode-hook)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
678
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
679 ;; 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
680 ;; gnus-group-server instead works for me. -- Justus Piater
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
681 (defmacro nnir-group-server (group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
682 "Return the server for a newsgroup GROUP.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
683 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
684 `gnus-group-real-prefix' and `gnus-group-real-name'."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
685 `(let ((gname ,group))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
686 (if (string-match "^\\([^:]+\\):" gname)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
687 (progn
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
688 (setq gname (match-string 1 gname))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
689 (if (string-match "^\\([^+]+\\)\\+\\(.+\\)$" gname)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
690 (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
691 (concat gname ":")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
692 (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
693
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
694 ;; Summary mode commands.
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 (defun gnus-summary-nnir-goto-thread ()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
697 "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
698 and show thread that contains this article."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
699 (interactive)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
700 (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
701 (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
702 (let* ((cur (gnus-summary-article-number))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
703 (group (nnir-artlist-artitem-group nnir-artlist cur))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
704 (backend-number (nnir-artlist-artitem-number nnir-artlist cur))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
705 server backend-group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
706 (setq server (nnir-group-server group))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
707 (setq backend-group (gnus-group-real-name group))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
708 (gnus-group-read-ephemeral-group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
709 backend-group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
710 (gnus-server-to-method server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
711 t ; activate
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
712 (cons (current-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
713 'summary) ; window config
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
714 nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
715 (list backend-number))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
716 (gnus-summary-limit (list backend-number))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
717 (gnus-summary-refer-thread)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
718
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
719 (if (fboundp 'eval-after-load)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
720 (eval-after-load "gnus-sum"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
721 '(define-key gnus-summary-goto-map
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
722 "T" 'gnus-summary-nnir-goto-thread))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
723 (add-hook 'gnus-summary-mode-hook
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
724 (function (lambda ()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
725 (define-key gnus-summary-goto-map
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
726 "T" 'gnus-summary-nnir-goto-thread)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
727
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
728
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 ;; Gnus backend interface functions.
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 (deffoo nnir-open-server (server &optional definitions)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
733 ;; Just set the server variables appropriately.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
734 (nnoo-change-server 'nnir server definitions))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
735
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
736 (deffoo nnir-request-group (group &optional server fast)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
737 "GROUP is the query string."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
738 (nnir-possibly-change-server server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
739 ;; Check for cache and return that if appropriate.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
740 (if (and (equal group nnir-current-query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
741 (equal gnus-group-marked nnir-current-group-marked)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
742 (or (null server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
743 (equal server nnir-current-server)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
744 nnir-artlist
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
745 ;; Cache miss.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
746 (setq nnir-artlist (nnir-run-query group)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
747 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
748 (set-buffer nntp-server-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
749 (if (zerop (length nnir-artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
750 (progn
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
751 (setq nnir-current-query nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
752 nnir-current-server nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
753 nnir-current-group-marked nil
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
754 nnir-artlist nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
755 (nnheader-report 'nnir "Search produced empty results."))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
756 ;; Remember data for cache.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
757 (setq nnir-current-query group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
758 (when server (setq nnir-current-server server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
759 (setq nnir-current-group-marked gnus-group-marked)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
760 (nnheader-insert "211 %d %d %d %s\n"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
761 (nnir-artlist-length nnir-artlist) ; total #
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
762 1 ; first #
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
763 (nnir-artlist-length nnir-artlist) ; last #
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
764 group)))) ; group name
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
765
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
766 (deffoo nnir-retrieve-headers (articles &optional group server fetch-old)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
767 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
768 (let ((artlist (copy-sequence articles))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
769 art artitem artgroup artno artrsv artfullgroup
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
770 novitem novdata foo server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
771 (while (not (null artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
772 (setq art (car artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
773 (or (numberp art)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
774 (nnheader-report
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
775 'nnir
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
776 "nnir-retrieve-headers doesn't grok message ids: %s"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
777 art))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
778 (setq artitem (nnir-artlist-article nnir-artlist art))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
779 (setq artrsv (nnir-artitem-rsv artitem))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
780 (setq artfullgroup (nnir-artitem-group artitem))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
781 (setq artno (nnir-artitem-number artitem))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
782 (setq artgroup (gnus-group-real-name artfullgroup))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
783 (setq server (nnir-group-server artfullgroup))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
784 ;; retrieve NOV or HEAD data for this article, transform into
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
785 ;; NOV data and prepend to `novdata'
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
786 (set-buffer nntp-server-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
787 (nnir-possibly-change-server server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
788 (let ((gnus-override-method
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
789 (gnus-server-to-method server)))
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
790 ;; 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
791 (if nnir-get-article-nov-override-function
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
792 (setq novitem (funcall nnir-get-article-nov-override-function
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
793 artitem))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
794 ;; else, set novitem through nnheader-parse-nov/nnheader-parse-head
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
795 (case (setq foo (gnus-retrieve-headers (list artno)
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
796 artfullgroup nil))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
797 (nov
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
798 (goto-char (point-min))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
799 (setq novitem (nnheader-parse-nov))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
800 (unless novitem
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
801 (pop-to-buffer nntp-server-buffer)
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
802 (error
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
803 "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
804 artno artfullgroup)))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
805 (headers
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
806 (goto-char (point-min))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
807 (setq novitem (nnheader-parse-head))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
808 (unless novitem
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
809 (pop-to-buffer nntp-server-buffer)
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
810 (error
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
811 "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
812 artno artfullgroup)))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
813 (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
814 foo artno artfullgroup)))))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
815 ;; replace article number in original group with article number
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
816 ;; in nnir group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
817 (mail-header-set-number novitem art)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
818 (mail-header-set-from novitem
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
819 (mail-header-from novitem))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
820 (mail-header-set-subject
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
821 novitem
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
822 (format "[%d: %s/%d] %s"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
823 artrsv artgroup artno
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
824 (mail-header-subject novitem)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
825 ;;-(mail-header-set-extra novitem nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
826 (push novitem novdata)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
827 (setq artlist (cdr artlist)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
828 (setq novdata (nreverse novdata))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
829 (set-buffer nntp-server-buffer) (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
830 (mapc 'nnheader-insert-nov novdata)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
831 'nov)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
832
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
833 (deffoo nnir-request-article (article
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
834 &optional group server to-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
835 (if (stringp article)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
836 (nnheader-report
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
837 'nnir
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
838 "nnir-retrieve-headers doesn't grok message ids: %s"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
839 article)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
840 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
841 (let* ((artitem (nnir-artlist-article nnir-artlist
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
842 article))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
843 (artfullgroup (nnir-artitem-group artitem))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
844 (artno (nnir-artitem-number artitem))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
845 ;; Bug?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
846 ;; 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
847 ;; 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
848 ;; line below must then be updated, too.)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
849 (nntp-server-buffer (or to-buffer nntp-server-buffer)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
850 (set-buffer nntp-server-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
851 (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
852 (message "Requesting article %d from group %s"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
853 artno artfullgroup)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
854 (gnus-request-article artno artfullgroup nntp-server-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
855 (cons artfullgroup artno)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
856
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 (nnoo-define-skeleton nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
859
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 (defmacro nnir-add-result (dirnam artno score prefix server artlist)
95616
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
862 "Ask `nnir-compose-result' to construct a result vector,
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
863 and if it is non-nil, add it to artlist."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
864 `(let ((result (nnir-compose-result ,dirnam ,artno ,score ,prefix ,server)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
865 (when (not (null result))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
866 (push result ,artlist))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
867
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
868 (autoload 'nnmaildir-base-name-to-article-number "nnmaildir")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
869
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
870 ;; Helper function currently used by the Swish++ and Namazu backends;
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
871 ;; perhaps useful for other backends as well
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
872 (defun nnir-compose-result (dirnam article score prefix server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
873 "Extract the group from dirnam, and create a result vector
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
874 ready to be added to the list of search results."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
875
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
876 ;; remove nnir-*-remove-prefix from beginning of dirnam filename
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
877 (when (string-match (concat "^" prefix) dirnam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
878 (setq dirnam (replace-match "" t t dirnam)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
879
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
880 (when (file-readable-p (concat prefix dirnam article))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
881 ;; remove trailing slash and, for nnmaildir, cur/new/tmp
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
882 (setq dirnam
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
883 (substring dirnam 0 (if (string= server "nnmaildir:") -5 -1)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
884
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
885 ;; Set group to dirnam without any leading dots or slashes,
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
886 ;; and with all subsequent slashes replaced by dots
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
887 (let ((group (gnus-replace-in-string
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
888 (gnus-replace-in-string dirnam "^[./\\]" "" t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
889 "[/\\]" "." t)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
890
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
891 (vector (nnir-group-full-name group server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
892 (if (string= server "nnmaildir:")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
893 (nnmaildir-base-name-to-article-number
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
894 (substring article 0 (string-match ":" article))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
895 group nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
896 (string-to-number article))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
897 (string-to-number score)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
898
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
899 ;;; Search Engine Interfaces:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
900
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
901 ;; freeWAIS-sf interface.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
902 (defun nnir-run-waissearch (query server &optional group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
903 "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
904 pairs (also vectors, actually)."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
905 (when group
105167
e14dfafc8256 * gnus-art.el (gnus-article-encrypt-body):
Juanma Barranquero <lekktu@gmail.com>
parents: 104700
diff changeset
906 (error "The freeWAIS-sf backend cannot search specific groups"))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
907 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
908 (let ((qstring (cdr (assq 'query query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
909 (prefix (nnir-read-server-parm 'nnir-wais-remove-prefix server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
910 artlist score artno dirnam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
911 (set-buffer (get-buffer-create nnir-tmp-buffer))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
912 (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
913 (message "Doing WAIS query %s..." query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
914 (call-process nnir-wais-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
915 nil ; input from /dev/null
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
916 t ; output to current buffer
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
917 nil ; don't redisplay
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
918 "-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
919 qstring)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
920 (message "Massaging waissearch output...")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
921 ;; remove superfluous lines
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
922 (keep-lines "Score:")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
923 ;; extract data from result lines
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
924 (goto-char (point-min))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
925 (while (re-search-forward
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
926 "Score: +\\([0-9]+\\).*'\\([0-9]+\\) +\\([^']+\\)/'" nil t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
927 (setq score (match-string 1)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
928 artno (match-string 2)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
929 dirnam (match-string 3))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
930 (unless (string-match prefix dirnam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
931 (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
932 dirnam prefix))
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
933 (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
934 (replace-match "" t t dirnam) "/" "."))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
935 (push (vector (nnir-group-full-name group server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
936 (string-to-number artno)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
937 (string-to-number score))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
938 artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
939 (message "Massaging waissearch output...done")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
940 (apply 'vector
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
941 (sort artlist
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
942 (function (lambda (x y)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
943 (> (nnir-artitem-rsv x)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
944 (nnir-artitem-rsv y)))))))))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
945
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
946 ;; IMAP interface.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
947 ;; todo:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
948 ;; nnir invokes this two (2) times???!
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
949 ;; 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
950 ;; 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
951 ;; send queries as literals
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
952 ;; handle errors
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
953
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
954 (autoload 'nnimap-open-server "nnimap")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
955 (defvar nnimap-server-buffer) ;; nnimap.el
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
956 (autoload 'imap-mailbox-select "imap")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
957 (autoload 'imap-search "imap")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
958 (autoload 'imap-quote-specials "imap")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
959
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
960 (defun nnir-run-imap (query srv &optional group-option)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
961 "Run a search against an IMAP back-end server.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
962 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
963 details on the language and supported extensions"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
964 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
965 (let ((qstring (cdr (assq 'query query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
966 (server (cadr (gnus-server-to-method srv)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
967 (group (or group-option (gnus-group-group-name)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
968 (defs (caddr (gnus-server-to-method srv)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
969 (criteria (or (cdr (assq 'criteria query))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
970 nnir-imap-search-field))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
971 artlist buf)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
972 (message "Opening server %s" server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
973 (condition-case ()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
974 (when (nnimap-open-server server defs) ;; xxx
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
975 (setq buf nnimap-server-buffer) ;; xxx
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
976 (message "Searching %s..." group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
977 (let ((arts 0)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
978 (mbx (gnus-group-real-name group)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
979 (when (imap-mailbox-select mbx nil buf)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
980 (mapc
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
981 (lambda (artnum)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
982 (push (vector group artnum 1) artlist)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
983 (setq arts (1+ arts)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
984 (imap-search (nnir-imap-make-query criteria qstring) buf))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
985 (message "Searching %s... %d matches" mbx arts)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
986 (message "Searching %s...done" group))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
987 (quit nil))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
988 (reverse artlist))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
989
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
990 (defun nnir-imap-make-query (criteria qstring)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
991 "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
992 expression, returning the string query to make.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
993
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
994 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
995 to an arbitrary query string to the end user.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
996
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
997 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
998 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
999
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1000 Automatic \"and\" queries
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1001 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
1002 expression intended to match all components.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1003
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1004 Phrase searches
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1005 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
1006 literal string.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1007
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1008 Negative terms
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1009 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
1010
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1011 \"OR\" queries
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1012 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
1013 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
1014
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1015 In future the following will be added to the language:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1016 * support for date matches
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1017 * support for location of text matching within the query
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1018 * from/to/etc headers
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1019 * additional search terms
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1020 * flag based searching
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1021 * anything else that the RFC supports, basically."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1022 ;; 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
1023 (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
1024
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1025
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1026 (defun nnir-imap-query-to-imap (criteria query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1027 "Turn a s-expression format query into IMAP."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1028 (mapconcat
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1029 ;; Turn the expressions into IMAP text
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1030 (lambda (item)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1031 (nnir-imap-expr-to-imap criteria item))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1032 ;; The query, already in s-expr format.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1033 query
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1034 ;; Append a space between each expression
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1035 " "))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1036
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 (defun nnir-imap-expr-to-imap (criteria expr)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1039 "Convert EXPR into an IMAP search expression on CRITERIA"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1040 ;; What sort of expression is this, eh?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1041 (cond
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1042 ;; Simple string term
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1043 ((stringp expr)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1044 (format "%s \"%s\"" criteria (imap-quote-specials expr)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1045 ;; Trivial term: and
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1046 ((eq expr 'and) nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1047 ;; Composite term: or expression
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1048 ((eq (car-safe expr) 'or)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1049 (format "OR %s %s"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1050 (nnir-imap-expr-to-imap criteria (second expr))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1051 (nnir-imap-expr-to-imap criteria (third expr))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1052 ;; Composite term: just the fax, mam
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1053 ((eq (car-safe expr) 'not)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1054 (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
1055 ;; Composite term: just expand it all.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1056 ((and (not (null expr)) (listp expr))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1057 (format "(%s)" (nnir-imap-query-to-imap criteria expr)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1058 ;; Complex value, give up for now.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1059 (t (error "Unhandled input: %S" expr))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1060
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1061
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1062 (defun nnir-imap-parse-query (string)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1063 "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
1064 query language as defined in `nnir-imap-make-query'.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1065
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1066 This involves turning individual tokens into higher level terms
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1067 that the search language can then understand and use."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1068 (with-temp-buffer
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1069 ;; Set up the parsing environment.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1070 (insert string)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1071 (goto-char (point-min))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1072 ;; Now, collect the output terms and return them.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1073 (let (out)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1074 (while (not (nnir-imap-end-of-input))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1075 (push (nnir-imap-next-expr) out))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1076 (reverse out))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1077
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 (defun nnir-imap-next-expr (&optional count)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1080 "Return the next expression from the current buffer."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1081 (let ((term (nnir-imap-next-term count))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1082 (next (nnir-imap-peek-symbol)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1083 ;; Are we looking at an 'or' expression?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1084 (cond
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1085 ;; Handle 'expr or expr'
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1086 ((eq next 'or)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1087 (list 'or term (nnir-imap-next-expr 2)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1088 ;; Anything else
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1089 (t term))))
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-term (&optional count)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1093 "Return the next TERM from the current buffer."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1094 (let ((term (nnir-imap-next-symbol count)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1095 ;; What sort of term is this?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1096 (cond
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1097 ;; and -- just ignore it
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1098 ((eq term 'and) 'and)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1099 ;; negated term
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1100 ((eq term 'not) (list 'not (nnir-imap-next-expr)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1101 ;; generic term
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-peek-symbol ()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1106 "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
1107 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1108 (nnir-imap-next-symbol)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1109
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1110 (defun nnir-imap-next-symbol (&optional count)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1111 "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
1112 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
1113 returning the one at the supplied position."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1114 (when (and (numberp count) (> count 1))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1115 (nnir-imap-next-symbol (1- count)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1116 (let ((case-fold-search t))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1117 ;; end of input stream?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1118 (unless (nnir-imap-end-of-input)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1119 ;; No, return the next symbol from the stream.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1120 (cond
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1121 ;; negated expression -- return it and advance one char.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1122 ((looking-at "-") (forward-char 1) 'not)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1123 ;; quoted string
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1124 ((looking-at "\"") (nnir-imap-delimited-string "\""))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1125 ;; 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
1126 ((looking-at "(")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1127 (nnir-imap-parse-query (nnir-imap-delimited-string ")")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1128 ;; keyword input -- return a symbol version
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1129 ((looking-at "\\band\\b") (forward-char 3) 'and)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1130 ((looking-at "\\bor\\b") (forward-char 2) 'or)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1131 ((looking-at "\\bnot\\b") (forward-char 3) 'not)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1132 ;; Simple, boring keyword
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1133 (t (let ((start (point))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1134 (end (if (search-forward-regexp "[[:blank:]]" nil t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1135 (prog1
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1136 (match-beginning 0)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1137 ;; unskip if we hit a non-blank terminal character.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1138 (when (string-match "[^[:blank:]]" (match-string 0))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1139 (backward-char 1)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1140 (goto-char (point-max)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1141 (buffer-substring start end)))))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1142
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1143 (defun nnir-imap-delimited-string (delimiter)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1144 "Return a delimited string from the current buffer."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1145 (let ((start (point)) end)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1146 (forward-char 1) ; skip the first delimiter.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1147 (while (not end)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1148 (unless (search-forward delimiter nil t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1149 (error "Unmatched delimited input with %s in query" delimiter))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1150 (let ((here (point)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1151 (unless (equal (buffer-substring (- here 2) (- here 1)) "\\")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1152 (setq end (point)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1153 (buffer-substring (1+ start) (1- end))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1154
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1155 (defun nnir-imap-end-of-input ()
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1156 "Are we at the end of input?"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1157 (skip-chars-forward "[[:blank:]]")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1158 (looking-at "$"))
95616
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
1159
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1160
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1161 ;; Swish++ interface.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1162 ;; -cc- Todo
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1163 ;; Search by
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1164 ;; - group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1165 ;; Sort by
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1166 ;; - rank (default)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1167 ;; - article number
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1168 ;; - file size
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1169 ;; - group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1170 (defun nnir-run-swish++ (query server &optional group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1171 "Run QUERY against swish++.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1172 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
1173 actually).
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1174
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1175 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
1176 Windows NT 4.0."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1177
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1178 (when group
105167
e14dfafc8256 * gnus-art.el (gnus-article-encrypt-body):
Juanma Barranquero <lekktu@gmail.com>
parents: 104700
diff changeset
1179 (error "The swish++ backend cannot search specific groups"))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1180
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1181 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1182 (let ( (qstring (cdr (assq 'query query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1183 (groupspec (cdr (assq 'group query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1184 (prefix (nnir-read-server-parm 'nnir-swish++-remove-prefix server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1185 artlist
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1186 ;; 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
1187 ;; 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
1188 ;; nnml-use-compressed-files because old articles might have been
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1189 ;; saved with a different value.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1190 (article-pattern (if (string= server "nnmaildir:")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1191 ":[0-9]+"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1192 "^[0-9]+\\(\\.[a-z0-9]+\\)?$"))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1193 score artno dirnam filenam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1194
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1195 (when (equal "" qstring)
105167
e14dfafc8256 * gnus-art.el (gnus-article-encrypt-body):
Juanma Barranquero <lekktu@gmail.com>
parents: 104700
diff changeset
1196 (error "swish++: You didn't enter anything"))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1197
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1198 (set-buffer (get-buffer-create nnir-tmp-buffer))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1199 (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1200
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1201 (if groupspec
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1202 (message "Doing swish++ query %s on %s..." qstring groupspec)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1203 (message "Doing swish++ query %s..." qstring))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1204
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1205 (let* ((cp-list `( ,nnir-swish++-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1206 nil ; input from /dev/null
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1207 t ; output
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1208 nil ; don't redisplay
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1209 "--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
1210 ,@(nnir-read-server-parm 'nnir-swish++-additional-switches server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1211 ,qstring ; the query, in swish++ format
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1212 ))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1213 (exitstatus
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1214 (progn
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1215 (message "%s args: %s" nnir-swish++-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1216 (mapconcat 'identity (cddddr cp-list) " ")) ;; ???
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1217 (apply 'call-process cp-list))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1218 (unless (or (null exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1219 (zerop exitstatus))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1220 (nnheader-report 'nnir "Couldn't run swish++: %s" exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1221 ;; swish++ failure reason is in this buffer, show it if
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1222 ;; the user wants it.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1223 (when (> gnus-verbose 6)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1224 (display-buffer nnir-tmp-buffer))))
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 ;; The results are output in the format of:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1227 ;; V 4.7 Linux
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1228 ;; rank relative-path-name file-size file-title
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1229 ;; V 5.0b2:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1230 ;; rank relative-path-name file-size topic??
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1231 ;; where rank is an integer from 1 to 100.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1232 (goto-char (point-min))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1233 (while (re-search-forward
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1234 "\\(^[0-9]+\\) \\([^ ]+\\) [0-9]+ \\(.*\\)$" nil t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1235 (setq score (match-string 1)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1236 filenam (match-string 2)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1237 artno (file-name-nondirectory filenam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1238 dirnam (file-name-directory filenam))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1239
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1240 ;; don't match directories
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1241 (when (string-match article-pattern artno)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1242 (when (not (null dirnam))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1243
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1244 ;; maybe limit results to matching groups.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1245 (when (or (not groupspec)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1246 (string-match groupspec dirnam))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1247 (nnir-add-result dirnam artno score prefix server artlist)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1248
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1249 (message "Massaging swish++ output...done")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1250
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1251 ;; Sort by score
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1252 (apply 'vector
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1253 (sort artlist
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1254 (function (lambda (x y)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1255 (> (nnir-artitem-rsv x)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1256 (nnir-artitem-rsv y)))))))))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1257
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1258 ;; Swish-E interface.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1259 (defun nnir-run-swish-e (query server &optional group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1260 "Run given query against swish-e.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1261 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
1262 actually).
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 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
1265
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1266 ;; swish-e crashes with empty parameter to "-w" on commandline...
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1267 (when group
105167
e14dfafc8256 * gnus-art.el (gnus-article-encrypt-body):
Juanma Barranquero <lekktu@gmail.com>
parents: 104700
diff changeset
1268 (error "The swish-e backend cannot search specific groups"))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1269
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1270 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1271 (let ((qstring (cdr (assq 'query query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1272 (prefix
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1273 (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
1274 (error "Missing parameter `nnir-swish-e-remove-prefix'")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1275 artlist score artno dirnam group )
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 (when (equal "" qstring)
105167
e14dfafc8256 * gnus-art.el (gnus-article-encrypt-body):
Juanma Barranquero <lekktu@gmail.com>
parents: 104700
diff changeset
1278 (error "swish-e: You didn't enter anything"))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1279
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1280 (set-buffer (get-buffer-create nnir-tmp-buffer))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1281 (erase-buffer)
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 (message "Doing swish-e query %s..." query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1284 (let* ((index-files
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1285 (or (nnir-read-server-parm
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1286 'nnir-swish-e-index-files server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1287 (error "Missing parameter `nnir-swish-e-index-files'")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1288 (additional-switches
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1289 (nnir-read-server-parm
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1290 'nnir-swish-e-additional-switches server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1291 (cp-list `(,nnir-swish-e-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1292 nil ; input from /dev/null
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1293 t ; output
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1294 nil ; don't redisplay
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1295 "-f" ,@index-files
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1296 ,@additional-switches
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1297 "-w"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1298 ,qstring ; the query, in swish-e format
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1299 ))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1300 (exitstatus
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1301 (progn
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1302 (message "%s args: %s" nnir-swish-e-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1303 (mapconcat 'identity (cddddr cp-list) " "))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1304 (apply 'call-process cp-list))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1305 (unless (or (null exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1306 (zerop exitstatus))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1307 (nnheader-report 'nnir "Couldn't run swish-e: %s" exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1308 ;; 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
1309 ;; the user wants it.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1310 (when (> gnus-verbose 6)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1311 (display-buffer nnir-tmp-buffer))))
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 ;; The results are output in the format of:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1314 ;; rank path-name file-title file-size
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1315 (goto-char (point-min))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1316 (while (re-search-forward
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1317 "\\(^[0-9]+\\) \\([^ ]+\\) \"\\([^\"]+\\)\" [0-9]+$" nil t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1318 (setq score (match-string 1)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1319 artno (match-string 3)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1320 dirnam (file-name-directory (match-string 2)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1321
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1322 ;; don't match directories
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1323 (when (string-match "^[0-9]+$" artno)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1324 (when (not (null dirnam))
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 ;; remove nnir-swish-e-remove-prefix from beginning of dirname
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1327 (when (string-match (concat "^" prefix) dirnam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1328 (setq dirnam (replace-match "" t t dirnam)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1329
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1330 (setq dirnam (substring dirnam 0 -1))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1331 ;; eliminate all ".", "/", "\" from beginning. Always matches.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1332 (string-match "^[./\\]*\\(.*\\)$" dirnam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1333 ;; "/" -> "."
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1334 (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
1335 ;; Windows "\\" -> "."
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1336 (setq group (gnus-replace-in-string group "\\\\" "."))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1337
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1338 (push (vector (nnir-group-full-name group server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1339 (string-to-number artno)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1340 (string-to-number score))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1341 artlist))))
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 (message "Massaging swish-e output...done")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1344
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1345 ;; Sort by score
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1346 (apply 'vector
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1347 (sort artlist
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1348 (function (lambda (x y)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1349 (> (nnir-artitem-rsv x)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1350 (nnir-artitem-rsv y)))))))))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1351
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1352 ;; HyREX interface
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1353 (defun nnir-run-hyrex (query server &optional group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1354 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1355 (let ((artlist nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1356 (groupspec (cdr (assq 'group query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1357 (qstring (cdr (assq 'query query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1358 (prefix (nnir-read-server-parm 'nnir-hyrex-remove-prefix server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1359 score artno dirnam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1360 (when (and group groupspec)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1361 (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
1362 " with process-marked groups.")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1363 (when group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1364 (setq groupspec (gnus-group-real-name group)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1365 (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
1366 (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
1367 (error "Server with groupspec doesn't match group !"))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1368 (set-buffer (get-buffer-create nnir-tmp-buffer))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1369 (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1370 (if groupspec
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1371 (message "Doing hyrex-search query %s on %s..." query groupspec)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1372 (message "Doing hyrex-search query %s..." query))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1373 (let* ((cp-list
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1374 `( ,nnir-hyrex-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1375 nil ; input from /dev/null
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1376 t ; output
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1377 nil ; don't redisplay
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1378 "-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
1379 ,@(nnir-read-server-parm 'nnir-hyrex-additional-switches server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1380 ,qstring ; the query, in hyrex-search format
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1381 ))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1382 (exitstatus
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1383 (progn
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1384 (message "%s args: %s" nnir-hyrex-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1385 (mapconcat 'identity (cddddr cp-list) " "))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1386 (apply 'call-process cp-list))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1387 (unless (or (null exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1388 (zerop exitstatus))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1389 (nnheader-report 'nnir "Couldn't run hyrex-search: %s" exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1390 ;; 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
1391 ;; the user wants it.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1392 (when (> gnus-verbose 6)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1393 (display-buffer nnir-tmp-buffer)))) ;; FIXME: Dont clear buffer !
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1394 (if groupspec
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1395 (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
1396 (message "Doing hyrex-search query \"%s\"...done" qstring))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1397 (sit-for 0)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1398 ;; nnir-search returns:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1399 ;; for nnml/nnfolder: "filename mailid weigth"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1400 ;; for nnimap: "group mailid weigth"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1401 (goto-char (point-min))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1402 (delete-non-matching-lines "^\\S + [0-9]+ [0-9]+$")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1403 ;; 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
1404 (when groupspec
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1405 (keep-lines groupspec))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1406 ;; extract data from result lines
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1407 (goto-char (point-min))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1408 (while (re-search-forward
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1409 "\\(\\S +\\) \\([0-9]+\\) \\([0-9]+\\)" nil t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1410 (setq dirnam (match-string 1)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1411 artno (match-string 2)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1412 score (match-string 3))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1413 (when (string-match prefix dirnam)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1414 (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
1415 (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
1416 (gnus-replace-in-string dirnam "/" ".") server)
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1417 (string-to-number artno)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1418 (string-to-number score))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1419 artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1420 (message "Massaging hyrex-search output...done.")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1421 (apply 'vector
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1422 (sort artlist
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1423 (function (lambda (x y)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1424 (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
1425 (nnir-artitem-group y))
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1426 t
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1427 (< (nnir-artitem-number x)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1428 (nnir-artitem-number y)))))))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1429 )))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1430
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1431 ;; Namazu interface
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1432 (defun nnir-run-namazu (query server &optional group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1433 "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
1434 pairs (also vectors, actually).
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1435
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1436 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
1437 (when group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1438 (error "The Namazu backend cannot search specific groups"))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1439 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1440 (let ((article-pattern (if (string= server "nnmaildir:")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1441 ":[0-9]+"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1442 "^[0-9]+$"))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1443 artlist
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1444 (qstring (cdr (assq 'query query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1445 (prefix (nnir-read-server-parm 'nnir-namazu-remove-prefix server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1446 score group article
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1447 (process-environment (copy-sequence process-environment)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1448 (setenv "LC_MESSAGES" "C")
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1449 (set-buffer (get-buffer-create nnir-tmp-buffer))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1450 (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1451 (let* ((cp-list
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1452 `( ,nnir-namazu-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1453 nil ; input from /dev/null
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1454 t ; output
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1455 nil ; don't redisplay
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1456 "-q" ; don't be verbose
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1457 "-a" ; show all matches
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1458 "-s" ; use short format
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1459 ,@(nnir-read-server-parm 'nnir-namazu-additional-switches server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1460 ,qstring ; the query, in namazu format
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1461 ,(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
1462 ))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1463 (exitstatus
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1464 (progn
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1465 (message "%s args: %s" nnir-namazu-program
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1466 (mapconcat 'identity (cddddr cp-list) " "))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1467 (apply 'call-process cp-list))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1468 (unless (or (null exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1469 (zerop exitstatus))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1470 (nnheader-report 'nnir "Couldn't run namazu: %s" exitstatus)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1471 ;; Namazu failure reason is in this buffer, show it if
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1472 ;; the user wants it.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1473 (when (> gnus-verbose 6)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1474 (display-buffer nnir-tmp-buffer))))
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 ;; Namazu output looks something like this:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1477 ;; 2. Re: Gnus agent expire broken (score: 55)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1478 ;; /home/henrik/Mail/mail/sent/1310 (4,138 bytes)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1479
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1480 (goto-char (point-min))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1481 (while (re-search-forward
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1482 "^\\([0-9]+\\.\\).*\\((score: \\([0-9]+\\)\\))\n\\([^ ]+\\)"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1483 nil t)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1484 (setq score (match-string 3)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1485 group (file-name-directory (match-string 4))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1486 article (file-name-nondirectory (match-string 4)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1487
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1488 ;; make sure article and group is sane
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1489 (when (and (string-match article-pattern article)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1490 (not (null group)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1491 (nnir-add-result group article score prefix server artlist)))
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 ;; sort artlist by score
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1494 (apply 'vector
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1495 (sort artlist
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1496 (function (lambda (x y)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1497 (> (nnir-artitem-rsv x)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1498 (nnir-artitem-rsv y)))))))))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1499
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1500 (defun nnir-run-find-grep (query server &optional group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1501 "Run find and grep to obtain matching articles."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1502 (let* ((method (gnus-server-to-method server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1503 (sym (intern
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1504 (concat (symbol-name (car method)) "-directory")))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1505 (directory (cadr (assoc sym (cddr method))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1506 (regexp (cdr (assoc 'query query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1507 (grep-options (cdr (assoc 'grep-options query)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1508 artlist)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1509 (unless directory
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1510 (error "No directory found in method specification of server %s"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1511 server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1512 (message "Searching %s using find-grep..." (or group server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1513 (save-window-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1514 (set-buffer (get-buffer-create nnir-tmp-buffer))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1515 (erase-buffer)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1516 (if (> gnus-verbose 6)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1517 (pop-to-buffer (current-buffer)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1518 (cd directory) ; Using relative paths simplifies postprocessing.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1519 (let ((group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1520 (if (not group)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1521 "."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1522 ;; Try accessing the group literally as well as
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1523 ;; 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
1524 ;; 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
1525 (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
1526 ;; Replace cl-func find-if.
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1527 (if (file-directory-p group)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1528 group
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1529 (if (file-directory-p
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1530 (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
1531 group))))))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1532 (unless group
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1533 (error "Cannot locate directory for group"))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1534 (save-excursion
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1535 (apply
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1536 'call-process "find" nil t
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1537 "find" group "-type" "f" "-name" "[0-9]*" "-exec"
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1538 "grep"
95830
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
1539 `("-l" ,@(and grep-options
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
1540 ;; Note: the 3rd arg of `split-string' is not
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
1541 ;; available in Emacs 21.
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
1542 (delete "" (split-string grep-options "\\s-")))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1543 "-e" ,regexp "{}" "+"))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1544
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1545 ;; Translate relative paths to group names.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1546 (while (not (eobp))
95830
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
1547 (let* ((path (delete
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
1548 ""
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
1549 (split-string
4bbbc2594f0b Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 95616
diff changeset
1550 (buffer-substring (point) (line-end-position)) "/")))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1551 (art (string-to-number (car (last path)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1552 (while (string= "." (car path))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1553 (setq path (cdr path)))
104584
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1554 (let ((group (mapconcat 'identity
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1555 ;; 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
1556 (let ((end (1- (length path)))
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1557 res)
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1558 (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
1559 (push (pop path) res))
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1560 (nreverse res))
f540e84a920d (top-level): Don't require cl at run-time.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1561 ".")))
95610
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1562 (push (vector (nnir-group-full-name group server) art 0)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1563 artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1564 (forward-line 1)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1565 (message "Searching %s using find-grep...done" (or group server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1566 artlist)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1567
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1568 ;;; Util Code:
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1569
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1570 (defun nnir-read-parms (query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1571 "Reads additional search parameters according to `nnir-engines'."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1572 (let ((parmspec (caddr (assoc nnir-search-engine nnir-engines))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1573 (cons (cons 'query query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1574 (mapcar 'nnir-read-parm parmspec))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1575
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1576 (defun nnir-read-parm (parmspec)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1577 "Reads a single search parameter.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1578 `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
1579 (let ((sym (car parmspec))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1580 (prompt (cdr parmspec)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1581 (if (listp prompt)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1582 (let* ((result (apply 'completing-read prompt))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1583 (mapping (or (assoc result nnir-imap-search-arguments)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1584 (assoc nil nnir-imap-search-arguments))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1585 (cons sym (format (cdr mapping) result)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1586 (cons sym (read-string prompt)))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1587
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1588 (defun nnir-run-query (query)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1589 "Invoke appropriate search engine function (see `nnir-engines').
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1590 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
1591 and concat the results."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1592 (let ((q (car (read-from-string query))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1593 (if gnus-group-marked
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1594 (apply 'vconcat
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1595 (mapcar (lambda (x)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1596 (let ((server (nnir-group-server x))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1597 search-func)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1598 (setq search-func (cadr
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1599 (assoc
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1600 (nnir-read-server-parm 'nnir-search-engine server) nnir-engines)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1601 (if search-func
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1602 (funcall search-func q server x)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1603 nil)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1604 gnus-group-marked)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1605 )
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1606 (apply 'vconcat
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1607 (mapcar (lambda (x)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1608 (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
1609 (let ((server (format "%s:%s" (caar x) (cadar x)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1610 search-func)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1611 (setq search-func (cadr
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1612 (assoc
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1613 (nnir-read-server-parm 'nnir-search-engine server) nnir-engines)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1614 (if search-func
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1615 (funcall search-func q server nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1616 nil))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1617 nil))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1618 gnus-opened-servers)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1619 ))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1620 ))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1621
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1622 (defun nnir-read-server-parm (key server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1623 "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
1624 form 'backend:name'."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1625 (let ((method (gnus-server-to-method server)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1626 (cond ((and method (assq key (cddr method)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1627 (nth 1 (assq key (cddr method))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1628 ((and nnir-mail-backend
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1629 (gnus-server-equal method nnir-mail-backend))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1630 (symbol-value key))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1631 (t nil))))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1632 ;; (if method
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1633 ;; (if (assq key (cddr method))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1634 ;; (nth 1 (assq key (cddr method)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1635 ;; (symbol-value key))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1636 ;; (symbol-value key))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1637 ;; ))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1638
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1639 (defun nnir-group-full-name (shortname server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1640 "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
1641 The Gnus backend/server information is added."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1642 (gnus-group-prefixed-name shortname (gnus-server-to-method server)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1643
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1644 (defun nnir-possibly-change-server (server)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1645 (unless (and server (nnir-server-opened server))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1646 (nnir-open-server server)))
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
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1649 ;; Data type article list.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1650
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1651 (defun nnir-artlist-length (artlist)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1652 "Returns number of articles in artlist."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1653 (length artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1654
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1655 (defun nnir-artlist-article (artlist n)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1656 "Returns from ARTLIST the Nth artitem (counting starting at 1)."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1657 (elt artlist (1- n)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1658
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1659 (defun nnir-artitem-group (artitem)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1660 "Returns the group from the ARTITEM."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1661 (elt artitem 0))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1662
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1663 (defun nnir-artlist-artitem-group (artlist n)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1664 "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
1665 (nnir-artitem-group (nnir-artlist-article artlist n)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1666
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1667 (defun nnir-artitem-number (artitem)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1668 "Returns the number from the ARTITEM."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1669 (elt artitem 1))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1670
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1671 (defun nnir-artlist-artitem-number (artlist n)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1672 "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
1673 (nnir-artitem-number (nnir-artlist-article artlist n)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1674
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1675 (defun nnir-artitem-rsv (artitem)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1676 "Returns the Retrieval Status Value (RSV, score) from the ARTITEM."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1677 (elt artitem 2))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1678
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1679 (defun nnir-artlist-artitem-rsv (artlist n)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1680 "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
1681 \(counting from 1)."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1682 (nnir-artitem-rsv (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 ;; unused?
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1685 (defun nnir-artlist-groups (artlist)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1686 "Returns a list of all groups in the given ARTLIST."
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1687 (let ((res nil)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1688 (with-dups nil))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1689 ;; from each artitem, extract group component
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1690 (setq with-dups (mapcar 'nnir-artitem-group artlist))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1691 ;; remove duplicates from above
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1692 (mapc (function (lambda (x) (add-to-list 'res x)))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1693 with-dups)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1694 res))
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1695
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1696
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1697 ;; The end.
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1698 (provide 'nnir)
cb95dadcb2de Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents:
diff changeset
1699
95616
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
1700 ;; arch-tag: 9b3fecf8-4397-4bbb-bf3c-6ac3cbbc6664
49755ce71b9e Formatting fixes.
Glenn Morris <rgm@gnu.org>
parents: 95610
diff changeset
1701 ;;; nnir.el ends here