Function: mh-swish-execute-search

mh-swish-execute-search is a byte-compiled function defined in mh-search.el.gz.

Signature

(mh-swish-execute-search FOLDER-PATH SEARCH-REGEXP)

Documentation

Execute swish-e.

In the examples below, replace "/home/user/Mail" with the path to your MH directory.

First create the directory "/home/user/Mail/.swish". Then create the file "/home/user/Mail/.swish/config" with the following contents:

     DefaultContents TXT*
     IndexDir /home/user/Mail
     IndexFile /home/user/Mail/.swish/index
     IndexName "Mail Index"
     IndexDescription "Mail Index"
     IndexPointer "http://nowhere"
     IndexAdmin "nobody"
     #MetaNames automatic
     IndexReport 3
     FollowSymLinks no
     UseStemming no
     IgnoreTotalWordCountWhenRanking yes
     WordCharacters abcdefghijklmnopqrstuvwxyz0123456789-
     BeginCharacters abcdefghijklmnopqrstuvwxyz
     EndCharacters abcdefghijklmnopqrstuvwxyz0123456789
     IgnoreLimit 50 1000
     IndexComments 0
     FileRules filename contains \D
     FileRules pathname contains /home/user/Mail/.swish
     FileRules pathname contains /home/user/Mail/mhe-index

This configuration does not index the folders that hold the results of your searches in "+mhe-index" since they tend to be ephemeral and the original messages are indexed anyway.

If there are any directories you would like to ignore, append lines like the following to "config":

     FileRules pathname contains /home/user/Mail/scripts

Use the following command line to generate the swish index. Run this daily from cron:

         swish-e -c /home/user/Mail/.swish/config

In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP is used to search.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-search.el.gz
(defun mh-swish-execute-search (folder-path search-regexp)
  "Execute swish-e.

In the examples below, replace \"/home/user/Mail\" with the path
to your MH directory.

First create the directory \"/home/user/Mail/.swish\". Then
create the file \"/home/user/Mail/.swish/config\" with the
following contents:

     DefaultContents TXT*
     IndexDir /home/user/Mail
     IndexFile /home/user/Mail/.swish/index
     IndexName \"Mail Index\"
     IndexDescription \"Mail Index\"
     IndexPointer \"http://nowhere\"
     IndexAdmin \"nobody\"
     #MetaNames automatic
     IndexReport 3
     FollowSymLinks no
     UseStemming no
     IgnoreTotalWordCountWhenRanking yes
     WordCharacters abcdefghijklmnopqrstuvwxyz0123456789-
     BeginCharacters abcdefghijklmnopqrstuvwxyz
     EndCharacters abcdefghijklmnopqrstuvwxyz0123456789
     IgnoreLimit 50 1000
     IndexComments 0
     FileRules filename contains \\D
     FileRules pathname contains /home/user/Mail/.swish
     FileRules pathname contains /home/user/Mail/mhe-index

This configuration does not index the folders that hold the
results of your searches in \"+mhe-index\" since they tend to be
ephemeral and the original messages are indexed anyway.

If there are any directories you would like to ignore, append
lines like the following to \"config\":

     FileRules pathname contains /home/user/Mail/scripts

Use the following command line to generate the swish index. Run
this daily from cron:

         swish-e -c /home/user/Mail/.swish/config

In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP
is used to search."
  (set-buffer (get-buffer-create mh-temp-index-buffer))
  (erase-buffer)
  (unless mh-swish-binary
    (error "Set `mh-swish-binary' appropriately"))
  (call-process mh-swish-binary nil '(t nil) nil
                "-w" search-regexp
                "-f" (format "%s%s/index" mh-user-path mh-swish-directory))
  (goto-char (point-min))
  (setq mh-swish-folder
        (let ((last-char (substring folder-path (1- (length folder-path)))))
          (if (equal last-char "/")
              folder-path
            (format "%s/" folder-path)))))