This tutorial is for users who begin using Namazu 2.0.
make
make install
This tutorial is written for
in order to reduce the workload when using Namazu. Please refer manual to learn all features in Namazu. Also, installation guide is given in INSTALL file.
History of Namazu development from 1.3.0.x through 2.0 is as follows.
Namazu broadly consists of three components, mknmz, namazu, namazu.cgi.
You need the following softwares to build Namazu 2.0.
Name | Description | Status | Current Version | Required Version | File name | Development and Distribution | Sources(Example) | Others |
---|---|---|---|---|---|---|---|---|
Perl | Perl Language | Required | 5.6.0 | 5.004 | perl-5.6.0.tar.gz | Larry Wall GNU CPAN | CPAN | |
nkf | Network Kanji Filter | for Japanese processing only | 1.92 | 1.71 | nkf171.shar | Shinji Kono | University of Ryukuyus | |
NKF | nkf Perl Module | for Japanese processing only. ++ | 1.92 | 1.71 | ||||
KAKASI | Japanese/Romaji Conversion | for Japanese processing only. ** | 2.3.2 | <= | kakasi-2.3.2.tar.gz | KAKASI Project | namazu.org | |
Text::Kakasi | KAKASI Perl Module | for Japanese processing only. ++ | 1.04 | <= | Text-Kakasi-1.04.tar.gz | NOKUBI Takatsugu | Text::Kakasi | |
ChaSen | (ChaSen) -- Japanese Morphology Analyzer | for Japanese processing only. ** | 2.02 | <= | chasen-sys2.02-ipadic2.1.tar.gz | Nara Institute of Sicence and Technology | ftp:// | Distribution Policy | For libchasen.a in ChaSen 2.02 or earlier, refer below. |
Text::ChaSen | ChaSen Perl Module | for Japanese processing only. ++ | 1.03 | <= | Text-ChaSen-1.03.tar.gz | NOKUBI Takatsugu | Text::ChaSen | |
File::MMagic | File Type | Included | 1.09 | <= | File-MMagic-1.09.tar.gz | NOKUBI Takatsugu | CPAN dist | This is packaged in Namazu distribution. |
If you have both ... | For segmentation, KAKASI is used by default, however, ChaSen can be used by specifying -c option. |
If you have only one ... | When executing ./configure, Namazu selects which one to use. |
perl
Makefile.PL; make; make install
. We recommend to
install Perl modules, unless you have particular reasons.
make install
does not install
/usr/local/lib/libchasen.a automatically. So to build
perl ChaSen module, you will need to do
cp libchasen.a /usr/local/lib ranlib /usr/local/lib/libchasen.a # depending on your systemmanually.
You will need to set up LANG
environment
variable to use Namazu 2.0 under Japanese environment. For
Windows, LANG is set to ja_JP.SJIS. For Unix, LANG is set to
ja
, ja_JP.eucJP
,
ja_JP.EUC
, or ja_JP.ujis
. The
appropriate LANG will depends on your system. If you have no
clues, just set LANG to ja
.
If you wish to test mknmz
before make
install
, do cd scripts
and
./mknmz
. This will refer adjacent
../pl/*.pl
. (not
/usr/local/share/namazu
).
(To know more about this, see @INC of load_module() in mknmz.)
You can, for example, try
./mknmz -C ./mknmz --help ./mknmz -O /tmp ~/Mail
If you just type mknmz
or namazu
with no argument, a short usage will be displayed. If you
feed --help
as an argument, a long usage will
be displayed. The option -C
will display the
configurations at the time. Useful to remember these 3
option usages.
Argument | Meaning | Other Arguments |
---|---|---|
None | Short Usage | Cannot add any argument |
--help | Long Usage | Ignores other arguments |
-C | Configurations | Other arguments will have meanings. |
First, create index.
(If you wish to run mknmz before make install
, please see
Test before
mknmz make install)
Format are changed slightly from versions 1.4.0.8.
URI replacement is dealt with by specifying
--replace option.
URI replacement can be done during namazu/namazu.cgi
execution. In this case, run mknmz without --replace option,
and setup .namazurc so
that URI replacement is performed during namazu/namazu.cgi
execution.
Run mknmz as follows.
mknmz [options] target directory
The above example creates index in the current directory.
Use -O
option to specify the output directory.
For example,
mkdir /tmp/index mknmz -O /tmp/index \ --replace='s#/foo/bar/doc/#http://foo.bar.jp/software/#' \ /foo/bar/doc
mknmz will output the following messages during the creation of index. If you wish to display messages in Japansese, please refer to Japanese Envirnment.
14 files are found to be indexed. 1/14 - /foo/bar/acrobat3.pdf [application/pdf] 2/14 - /foo/bar/excel97.xls [application/excel] 3/14 - /foo/bar/html.html [text/html] 4/14 - /foo/bar/mail-multipart.txt [message/rfc822] 5/14 - /foo/bar/mail.txt [message/rfc822] 6/14 - /foo/bar/man.1 [text/x-roff] 7/14 - /foo/bar/msg00000.html [text/html; x-type=mhonarc] 8/14 - /foo/bar/plain.txt [text/plain] 9/14 - /foo/bar/plain.txt.Z [text/plain] 10/14 - /foo/bar/plain.txt.bz2 [text/plain] 11/14 - /foo/bar/plain.txt.gz [text/plain] 12/14 - /foo/bar/rfc0000.txt [text/plain; x-type=rfc] 13/14 - /foo/bar/tex.tex [application/x-tex] 14/14 - /foo/bar/word97.doc [application/msword] Writing index files... [Base] Date: Thu Mar 16 22:14:01 2000 Added Documents: 14 Size (bytes): 58,701 Total Documents: 14 Added Keywords: 95 Total Keywords: 95 Wakati: module_kakasi -ieuc -oeuc -w Time (sec): 14 File/Sec: 1.00 System: linux Perl: 5.00503 Namazu: 2.0.2
/foo/bar/doc
This means "documents under /foo/bar/doc/
will appear as
http://foo.bar.jp/software/
, so please perform replacement like s#aaa#bbb# if written in Perl."
(In this example, (aaa) corresponds to (/foo/bar/doc/) and (bbb) corresponds to (http://foo.bar.jp/))
Namazu was originally developed for processing HTML documents, Namazu can now deal with various document styles. You will find useful scripts in /usr/local/share/namazu/filter, and detailed explanation will be found in Document filters in Namazu manual.
% mknmz ~/Mail/foobar
For mknmz command-line arguments, you get usage information from mknmz --help. With -C option, you get the configurations of the time.
Loaded rcfile: /home/foobar/.mknmzrc System: linux Namazu: 2.0.2 Perl: 5.00503 NKF: module_nkf KAKASI: module_kakasi -ieuc -oeuc -w ChaSen: module_chasen -j -F '%m ' Wakati: module_kakasi -ieuc -oeuc -w Lang: C Coding System: euc CONFDIR: /usr/local/etc/namazu LIBDIR: /usr/local/share/namazu/pl FILTERDIR: /usr/local/share/namazu/filter TEMPLATEDIR: /usr/local/share/namazu/template Supported media types: application/excel application/msword application/pdf application/x-bzip2 application/x-compress application/x-gzip application/x-tex message/news message/rfc822 text/hnf text/html text/html; x-type=mhonarc text/plain text/plain; x-type=rfc text/x-roff
short name | long name | description |
---|---|---|
-F | --target-list=FILE | read in list of target files for index creation |
-t | --media-type=MTYPE | specify the document format of target files |
--allow=PATTERN | specify the regular expression of target file names. | |
--deny=PATTERN | specify the regular expression of to-be-excluded file names. | |
--exclude=PATTERN | specify the regular expression of to-be-excluded path names. |
The current version cannot cope with symbolic link in the target directory.
To search documents, do
% namazu query index
If you omit index, namazu will assume
/usr/local/var/namazu/index
as target.
Set up for namazu
command will be done in
namazurc
.
An example of namazurc can be found in
/usr/local/etc/namazu/namazurc-sample
in Namazu
distribution package.
To use CGI on the web, you need to do various configuration. For Apache (Configuration)
ScriptAlias | /cgi-bin/ /usr/local/apache/cgi-bin/ | directory alias to /cgi-bin/ in URI |
AddHandler | cgi-script .cgi | execute cgi for files ending with ".cgi" |
AllowOverride | All | Allow .htaccess configuration (Web administrator) |
Options | ExecCGI | Allow cgi-bin execution
|
DirectoryIndex | index.html | file name to display when specifying directory in URI |
.htaccess
can do configurations other than the one
indicated by (Web administrator). (Note that these
configuration may be forbidden in Apache configuration.)
What is written here is not "guarantee". Just introduce the advanced usage that deveoplers have in mind.
(Preparaion) (Search display) mknmz namazu ^ | ^ | | v | v Original Document Index Search ResultNamazu prepares index of words in prior to the search request, and upon request, Namazu searches the document based on the prepared index. This "prepared index" is called index. In Namazu, NMZ.* are the index.
Index, Replace, Logging, Lang, Template
For further detail, see
Manual
perl -MText::Kakasi -e '' perl -MText::ChaSen -e '' perl -MNKF -e ''You can take advantage of Perl modules if nothing is displayed. If you then do ./configure in namazu, these Perl modules will be used.