Next: The hyrex Engine, Previous: The swish-e Engine, Up: Setting up nnir

##### 8.1.3.6 The namazu Engine

Using the namazu engine requires creating and maintaining index files. One directory should contain all the index files, and nnir must be told where to find them by setting the `nnir-namazu-index-directory` variable.

To work correctly the `nnir-namazu-remove-prefix` variable must also be correct. This is the prefix to remove from each file name returned by Namazu in order to get a proper group name (albeit with `/' instead of `.').

For example, suppose that Namazu returns file names such as ‘`/home/john/Mail/mail/misc/42`’. For this example, use the following setting: `(setq nnir-namazu-remove-prefix "/home/john/Mail/")` Note the trailing slash. Removing this prefix from the directory gives ‘`mail/misc/42`’. `nnir` knows to remove the ‘`/42`’ and to replace ‘`/`’ with ‘`.`’ to arrive at the correct group name ‘`mail.misc`’.

Extra switches may be passed to the namazu search command by setting the variable `nnir-namazu-additional-switches`. It is particularly important not to pass any any switches to namazu that will change the output format. Good switches to use include `–sort', `–ascending', `–early' and `–late'. Refer to the Namazu documentation for further information on valid switches.

Mail must first be indexed with the `mknmz' program. Read the documentation for namazu to create a configuration file. Here is an example:

          package conf;  # Don't remove this line!

          # Paths which will not be indexed. Don't use `^' or `$' anchors.
          $EXCLUDE_PATH = "spam|sent";

          # Header fields which should be searchable. case-insensitive
          $REMAIN_HEADER = "from|date|message-id|subject";

          # Searchable fields. case-insensitive
          $SEARCH_FIELD = "from|date|message-id|subject";

          # The max length of a word.
          $WORD_LENG_MAX = 128;

          # The max length of a field.
          $MAX_FIELD_LENGTH = 256;

For this example, mail is stored in the directories ‘`~/Mail/mail/`’, ‘`~/Mail/lists/`’ and ‘`~/Mail/archive/`’, so to index them go to the index directory set in `nnir-namazu-index-directory` and issue the following command:

         mknmz --mailnews ~/Mail/archive/ ~/Mail/mail/ ~/Mail/lists/

For maximum searching efficiency you might want to have a cron job run this command periodically, say every four hours.