Gnus development mailing list
 help / color / mirror / Atom feed
* Searching in all mails ...
@ 1997-10-12 23:45 Stefan Waldherr
  1997-10-13  7:58 ` Kai Grossjohann
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Waldherr @ 1997-10-12 23:45 UTC (permalink / raw)



is quite a pain in gnus. It would be really nice to have a feature (possibly
thru `G w' in the group buffer?) that searches thru all mails. glimpse is a
very fast search engine (http://glimpse.cs.arizona.edu/, there is also an
.rpm) that seems very good for this kind of task.

glimpse requires an index to search, so you index your mail regularily in a
cron job, for example

	glimpseindex -o -H ~/Mail/ ~/Mail/

This tells glimpse to index ~/Mail and leave an index file (size in this case
about 7-9% of all files) in ~/Mail/.glimpse_*.

Searching the index is even easier, for example

	glimpse -H ~/Mail/ 'web;server;account'

looks in the index file, that glimpse finds in ~/Mail/.glimpse_*) and returns
a list of matching mails in the form

/home/swa/Mail/bxx-users/14: An RWI web server account will be needed and is
availble free on request.
/home/swa/Mail/bxx-users/17: >An RWI web server account will be needed and is
availble free on request.

Wouldn't this be an extremely useful feature?

Stefan.
-- 
Stefan Waldherr                office +1 (412) 268-3837
                                  fax +1 (412) 268-5576
                               e-Mail swa@cs.cmu.edu
                                  www http://mind.learning.cs.cmu.edu/


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Searching in all mails ...
  1997-10-12 23:45 Searching in all mails Stefan Waldherr
@ 1997-10-13  7:58 ` Kai Grossjohann
  0 siblings, 0 replies; 2+ messages in thread
From: Kai Grossjohann @ 1997-10-13  7:58 UTC (permalink / raw)
  Cc: ding

>>>>> On 12 Oct 1997, Stefan Waldherr said:

  Stefan> It would be really nice to have a feature (possibly thru `G
  Stefan> w' in the group buffer?) that searches thru all mails.

I wish I had something that did the right thing.  But at least I have
something that sort of works for one group only.  Consider it to be an
intermediate solution till we get something better.

Usage: set gnus-glimpse-program and gnus-glimpse-options, type "G G"
in an nnml group.  Tell me about things that don't work as you expect.

kai
-- 
~/.signature: No such file or directory


;; gnus-glimpse.el -- search current group with glimpse
;; University of Dortmund, Information Retrieval Group, CS Dept.
;; RCS Status      : $Id$
;; Author          : Kai Grossjohann
;; Created On      : Tue May 20 19:08:10 1997
;; Last Modified By: 
;; Last Modified On: 
;; Update Count    : 0
;; Status          : Unknown, Use with caution!

(require 'gnus-sum)

(defvar gnus-glimpse-program
  "/app/sun4_55/unido-inf/glimpse/default/bin/glimpse"
  "Path to glimpse program to run.")

(defvar gnus-glimpse-options "-W -y -l"
  "Default options to pass to glimpse.")

(defvar gnus-glimpse-home-option-function nil
  "You can set this to a function which should return a glimpse option.
This can be used for per-group glimpse index files.  Just set this to
a function that returns -H <path.to.index>, for instance.
The function `gnus-glimpse-home-option-per-group' is provided as an
example.")

(defun gnus-glimpse-group-to-directory (group)
  "Return directory name for this group."
  (string-match "^nnml:\\(.*\\)$" group)
  (expand-file-name
   (concat nnml-directory
           (gnus-newsgroup-directory-form
            (substring group (match-beginning 1) (match-end 1))))))

(defun gnus-glimpse-group-option ()
  "Return the string used as the group option for glimpse."
  (let ((s (gnus-glimpse-group-to-directory gnus-newsgroup-name)))
    (string-match (expand-file-name "~/") s)
    (concat "-F '" (replace-match "" nil nil s 0)
            "/[0-9]'")))

(defun gnus-glimpse-home-option-per-group ()
  "Returns an option for Glimpse to search its index files in the
directory of the group.  Can be used as a value for
`gnus-glimpse-home-option-function'."
  (let ((s (gnus-glimpse-group-to-directory gnus-newsgroup-name)))
    (concat "-H '" s "'")))

(defun gnus-glimpse-home-option ()
  "If `gnus-glimpse-home-option-function' is set, call the function specified.
Otherwise, return an empty string."
  (if gnus-glimpse-home-option-function
      (apply gnus-glimpse-home-option-function nil)
    ""))

(defun gnus-summary-glimpse (glimpse-opt)
  (interactive "sGlimpse options: ")
  (let ((cmd (concat gnus-glimpse-program " "
             gnus-glimpse-options " "
             (gnus-glimpse-group-option) " "
             (gnus-glimpse-home-option) " "
             glimpse-opt))
        ;; gnus-newsgroup-name must be read in the summary buffer.  So
        ;; we do it here which is before switching to the glimpse
        ;; output buffer.
        (newsgroup-name gnus-newsgroup-name)
        (gnus-glimpse-articles nil)
        (num-articles nil)
        (cur-article 1))
    (save-excursion
      ;; Can't read gnus-newsgroup-name after the following line.
      (set-buffer (get-buffer-create " *glimpse output*"))
      (erase-buffer)
      (message "Running %s..." cmd) (sit-for 0)
      (shell-command cmd t)
      (message "Running %s...done" cmd) (sit-for 0)
      (goto-char (point-min))
      (while (re-search-forward
              (concat "^" (gnus-glimpse-group-to-directory newsgroup-name)
                      "/\\([0-9]*\\)$")
              nil t nil)
        (replace-match "\\1" nil nil))
      (sort-numeric-fields 1 (point-min) (point-max))
      (goto-char (point-min))
      (insert "(setq gnus-glimpse-articles '(\n")
      (goto-char (point-max))
      (insert "))")
      (eval-current-buffer)
      )
    (setq num-articles (length gnus-glimpse-articles))
    (message "Found %d articles." num-articles) (sit-for 0)
    (while gnus-glimpse-articles 
      (setq cur-article (1+ cur-article))
      (gnus-summary-goto-subject (pop gnus-glimpse-articles) t t))
    (sit-for 0)))

(define-key gnus-summary-goto-map "G" 'gnus-summary-glimpse)

(provide 'gnus-glimpse)

;; gnus-glimpse.el ends here
                           


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-10-13  7:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-12 23:45 Searching in all mails Stefan Waldherr
1997-10-13  7:58 ` Kai Grossjohann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).