[English | Japanese]
You can get the latest news about Namazu at http://www.namazu.org/. Namazu is free software under the terms of the GNU General Public License version 2 with ABSOLUTELY NO WARRANTY.
Namazu is a full-text search engine. Namazu uses the index maker
mknmz
command and the text searcher namazu
command.
For quickly searching through many documents, Namazu generates an index similar to that of a book's.
mknmz
command compiles the index. The target
directory for indexing is given as an argument for
mknmz
. For example, if the target directory is
/home/foo/public_html, then type
% mknmz
/home/foo/public_html
Now documents such as *.html and *.txt under /home/foo/public_html are indexed and NMZ.* files are created in the directory where you run mknmz. NMZ.* files are from Namazu's index.
The namazu
command searches the index. For
example:
% namazu
bar /home/foo/Namazu/foobar
The above searches a keyword "bar" for the index under /home/foo/Namazu/bar.
mknmz 2.0.X, an indexer of Namazu. Usage: mknmz [options] <target>... Target files: -a, --all target all files. -t, --media-type=MTYPE set the media type for all target files to MTYPE. -h, --mailnews same as --media-type='message/rfc822' --mhonarc same as --media-type='text/html; x-type=mhonarc' -F, --target-list=FILE load FILE which contains a list of target files. --allow=PATTERN set PATTERN for file names which should be allowed. --deny=PATTERN set PATTERN for file names which should be denied. --exclude=PATTERN set PATTERN for pathnames which should be excluded. -e, --robots exclude HTML files containing <meta name="ROBOTS" content="NOINDEX"> -M, --meta handle HTML meta tags for field-specified search. -r, --replace=CODE set CODE for replacing URI. --html-split split an HTML file with <a name="..."> anchors. --mtime=NUM limit by mtime just like find(1)'s -mtime option. e.g., -50 for recent 50 days, +50 for older than 50. Morphological Analysis: -b, --use-mecab use MeCab for analyzing Japanese. -c, --use-chasen use ChaSen for analyzing Japanese. -k, --use-kakasi use KAKASI for analyzing Japanese. -m, --use-chasen-noun use ChaSen for extracting only nouns. -L, --indexing-lang=LANG index with language specific processing. Text Operations: -E, --no-edge-symbol remove symbols on edge of word. -G, --no-okurigana remove Okurigana in word. -H, --no-hiragana ignore words consist of Hiragana only. -K, --no-symbol remove symbols. --decode-base64 decode base64 bodies within multipart entities. Summarization: -U, --no-encode-uri do not encode URI. -x, --no-heading-summary do not make summary with HTML's headings. Index Construction: --update=INDEX set INDEX for updating. -z, --check-filesize detect file size changed. -Y, --no-delete do not detect removed documents. -Z, --no-update do not detect update and deleted documents. Miscellaneous: -s, --checkpoint turn on the checkpoint mechanism. -C, --show-config show the current configuration. -f, --config=FILE use FILE as a config file. -I, --include=FILE include your customization FILE. -O, --output-dir=DIR set DIR to output the index. -T, --template-dir=DIR set DIR having NMZ.{head,foot,body}.*. -q, --quiet suppress status messages during execution. -v, --version show the version of namazu and exit. -V, --verbose be verbose. -d, --debug be debug mode. --help show this help and exit. --norc do not read the personal initialization files. -- Terminate option list. Report bugs to <http://www.namazu.org/trac-namazu/trac.cgi> or <bug-namazu@namazu.org>.
Various settings are possible in mknmzrc
or
.mknmzrc
. mknmzrc
normally reads
configuration files in the order of
$(sysconfdir)/$(PACKAGE)/mknmzrc
If more than one configuration file is found, they all of the files are loaded.
Installation prepares a sample configuration file
$(sysconfdir)/$(PACKAGE)/mknmzrc-sample
. You can copy
this to $(sysconfdir)/$(PACKAGE)/mknmzrc
or to
~/.mknmzrc
in your home directory.
The setting details are given as comments in
mknmzrc-sample
.
mknmz
automatically identifies target file types and
performs the appropriate document filtering. For HTML documents, filtering
includes the extraction of <title> or the deletion of HTML tags. The
filtering is dealt with by document filters in
$(datadir)/$(PACKAGE)/filter
. The standard document
filters are described below.
The following filters are for Windows only.
NOTE: We believe that mknmz will work well on both the English version and the Japanese version of Microsoft Office, but that is not yet confirmed. We would be grateful if you would notify us how it works. Thanks in advance.
namazu 2.0.X, a search program of Namazu. Usage: namazu [options] <query> [index]... -n, --max=NUM set the number of documents shown to NUM. -w, --whence=NUM set the first number of documents shown to NUM. -l, --list print the results by listing the format. -s, --short print the results in a short format. --result=EXT set NMZ.result.EXT for printing the results. --late sort the documents in late order. --early sort the documents in early order. --sort=METHOD set a sort METHOD (score, date, field:name) --ascending sort in ascending order (default: descending) -a, --all print all results. -c, --count print only the number of hits. -h, --html print in HTML format. -r, --no-references do not display the reference hit counts. -H, --page print the links of further results. (This is nearly meaningless) -F, --form force to print the <form> ... </form> region. -R, --no-replace do not replace the URI string. -U, --no-decode-uri do not decode the URI when printing in a plain format. -o, --output=FILE set the output file name to FILE. -f, --config=FILE set the config file name to FILE. -C, --show-config print the current configuration. -q, --quiet do not display extra messages except search results. -d, --debug be in debug mode. -v, --version show the namazu version and exit. --help show this help and exit. --norc do not read the personal initialization files. -- Terminate option list. Report bugs to <http://www.namazu.org/trac-namazu/trac.cgi> or <bug-namazu@namazu.org>.
You can specify one or more target indices in a command-line
argument [index dir]...
. If the target index is omitted, the Default index will be treated as
the target index.
By prefixing +
such as +foo or +bar, you can
specify a target index as a relative path from the default
index.
When executed from a command line, Namazu outputs query results in simple text format. The -h option is required in order to display query results in HTML format.
If you want to display query results from the 21st hit through the 40th, type -n 20 -w 20 on the command line. Note that -w is not 21 in this example.
Various settings are possible in mknmzrc
or
.mknmzrc
. Namazu normally reads configuration files in the following order:
$(sysconfdir)/$(PACKAGE)/namazurc
If more than one configuration file is found, all of the files are loaded.
Installation prepares a sample configuration file
$(sysconfdir)/$(PACKAGE)/namazurc-sample
. You can copy
this to $(sysconfdir)/$(PACKAGE)/namazurc
or to
~/.namazurc
in your home directory.
The setting details are given as comments in
namazurc-sample
.
The default index is the index that is used when no other index is specifiedand it follows the rules described below.
In CGI(namazu.cgi), the index selection is given as a relative path from the default index.
namazu.cgi
is the CGI script for Namazu. namazu.cgi is
installed in $(libexecdir)
directory (usually
/usr/local/libexec). If you copy namazu.cgi into a CGI
directory of your system, installation is done!
If you have a .namazurc file
in the directory where namazu.cgi is
stored, the .namazurc file
will be treated as a CGI
configuration file. For the display to be in Japanese, you need the following
settings:
Lang ja
Template files explain the display styles of query results in HTML. The details are described below.
These files are available for either language. Files suffixed by
.ja
are for Japanese.
Form is defined in NMZ.head. CGI variables are as follows:
To select an index from the browser, NMZ.head needs the following.
<strong>Target:</strong> <select name="idxname"> <option selected value="foo">foo</option> <option value="bar">bar</option> <option value="baz">baz</option> </select>
In the above example, you can select a single index from foo, bar, or
baz. When foo is selected, Namazu searches the foo index under the default index. In case the default index
is /usr/local/var/namazu/index
, there will be directories
as follows.
/ + usr/ + local/ + var/ + namazu/ + index/ + foo/ + bar/ + baz/
For selecting multiple indices NMZ.head needs a checkbox.
<strong>Target</strong> <ul> <li><input type="checkbox" name="idxname" value="foo">foo</li> <li><input type="checkbox" name="idxname" value="bar">bar</li> <li><input type="checkbox" name="idxname" value="baz">baz</li> </ul>
In the above example, you can select multiple indices from foo, bar,
and/or baz. The template file specified in the namazurc
Template directive is used in searching. If no file is given in the Template directive, the following rules apply.
You can set an auxiliary query apart from a user-inputing query. The following example describes a way to limit target pages by URI.
<strong>Target</strong> <select name="subquery"> <option value="">All</option> <option value="+uri:/^http://foo.bar.jp/foo//">foo's pages</option> <option value="+uri:/^http://foo.bar.jp/bar//">bar's pages</option> <option value="+uri:/^http://foo.bar.jp/baz//">baz's pages</option> <option value="+uri:/^http://foo.bar.jp/quux//">quux's pages</option> </select> <input type="hidden" name="reference" value="off">
To select the language of search results on your Web browser, you can
set NMZ.head with CGI variable lang
as follows:
<strong>Language:</strong> <select name="lang"> <option selected value="ja">Japanese</option> <option value="">English</option> </select>
NOTE: Lang directive in .namazurc has precedence over the CGI variable lang. Do not set the Lang directive in .namazurc if you want to use the CGI variable lang.
bnamazu
is a search tool that operates with Web
browsers. The query results are passed to a Web browser
(default:
lynx ) and from there to the users. The command line options are as follows.
% bnamazu [-n] [-b browser] [namazu's options] <query> [index]...
The -b option specifies a Web browser. The -n option is valid only when using netscape and it opens a new netscape window to display the query results.
nmzgrep is a search tool that operates with the egrep
command. nmzgrep executes egrep for retrieved documents. By applying
egrep, you can find the line numbers to places where the keyword is found. The command line options are as follows.
% nmzgrep [egrep's options] <pattern> [index]...
For example, in order to search the ~/Namazu/foobar index for foo and to apply egrep to the search documents, you can do as follows:
% nmzgrep foo ~/Namazu/foobar
When you update the indices after deleting or adding documents, garbage will be placed in index files. gcnmz
is a tool for garbage collection. The
command line options are as follows.
% gcnmz [options] <target>...
To run garbage collection for indices in ~/Namazu/foobar, type
% gcnmz ~/Namazu/foobar
mailutime
is a tool to set timestamps of
Mail/News files to the Date: header. The command line options
are as follows.
% mailutime <target>...
To change the time stamps of emails stored in ~/Mail/ml/foobar, type
% mailutime ~/Mail/ml/foobar/*
vfnmz is a tool to preview search results. The command line options are as follows.
% vfnmz <index> [NMZ.result.foobar]
To preview indices stored in ~/Mail/ml/foobar, type
% vfnmz ~/Namazu/foobar > foobar.html
% lynx foobar.html
rfnmz is a tool to reconstruct NMZ.field.*.i files. The usage is:
% rfnmz <index>
For example, to reconstruct NMZ.field.*.i files in the ~/Namazu/foobar index, you can do:
% rfnmz ~/Namazu/foobar
nmzegrep is a search tool that operates with the egrep
command and mknmz document filters.
nmzegrep executes egrep for retrieved documents. By applying
egrep, you can find the line numbers to places where the keyword is found. The command line options are as follows.
% nmzegrep [egrep's options] <pattern> [index]...
For example, in order to search the ~/Namazu/foobar index for foo and to apply egrep to the search documents, you can do as follows:
% nmzegrep foo ~/Namazu/foobar
NOTE: nmzegrep do egrep after passing the mknmz document filter for retrieved document. nmzegrep is slower than nmzgrep because it calls the document filter of mknmz. However, nmzegrep can do egrep for various file format.
nmzcat converts the binary files from various format to plain text.
% nmzcat <target>...
NOTE: nmzcat supports only the file of the type supported by mknmz.
This query specifies only one term for retrieving all of the documents which contain that term, for example:
namazu
This query specifies two or more terms for retrieving all of the
documents which contain both terms. Insert the
and
operator between the terms, e.g.
Linux and Netscape
You can omit the and
operator. Terms which are
separated by one ore more spaces are assumed to be an AND query.
This query specifies two or more terms for retrieving all
documents which contain any one term. Insert the
or
operator between the terms,
e.g.
Linux or FreeBSD
This query specifies two or more terms for retrieving all of the
documents which contain a first term but do not contain the
following terms. Insert the not
operator between the terms, for example:
Linux not UNIX
You can group queries by surrounding them by parentheses. The parentheses should be separated by one or more spaces. e.g.
( Linux or FreeBSD ) and Netscape not Windows
You can search for a phrase that consists of two or more terms
by surrounding them with double quotation marks or braces such as
"..."
and {...}
.
In Namazu, the precision of phrase searching is not 100 %,
so wrong results may occasionally occur. Example:
{GNU Emacs}
The are three types of searching by substring matching.
inter*
(terms which begin with inter
)*text*
(terms which contain text
)*net
(terms which terminated
with net
)
You can use regular expressions for pattern matching. The
regular expressions must be surrounded by slashes like /.../
. Namazu uses Ruby's regular
regular expressions engine. It generally offers a Perl compatible flavor.
e.g.,
/pro(gram|blem)s?/
You can limit your search to specific fields such as
Subject:
, From:
,
Message-Id:
. This feature is especially convenient for
Mail/News documents, for example:
+subject:Linux
Linux
in a Subject:
field)
+subject:"GNU Emacs"
GNU Emacs
in a Subject:
field)
+from:foo@bar.jp
foo@bar.jp
in a From:
field)
+message-id:<199801240555.OAA18737@foo.bar.jp>
Message-Id:
)
TCP/IP
. Since this method of handling isn't complete,
you can also describe the term as TCP and IP
instead of
TCP/IP
, but it may cause noisy results.
and
,
or
or not
simply as terms, you can
surround them with double quotes or braces like "..."
or {...}
.