You can get the latest news about Namazu at http://www.namazu.org/. Namazu is a 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 has an index maker,
mknmz
command, and a text searcher, namazu
command.
For searching a great amount of documents quickly, Namazu makes an index in advance. The concept of index is just similar to an index of book.
mknmz
command makes 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
Then, documents such as *.html and *.txt under /home/foo/public_html are indexed and NMZ.* files are created in the directory you run mknmz. NMZ.* files are the Namazu's index.
namazu
command searches the created 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: -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. 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. -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. --debug be debug mode. --help show this help and exit. Report bugs to <bug-namazu@namazu.org>.
Various setting is possible in mknmzrc
or
.mknmzrc
. mknmzrc
reads
configuration files normally in the order of
$(sysconfdir)/$(PACKAGE)/mknmzrc
If more than one configuration files are found, they all 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 appropriate document filtering. For HTML documents, filtering
includes extraction of <title> or deletion of HTML tags. These
filtering are taken care by document filters in
$(datadir)/$(PACKAGE)/filter
. The standard document
filters are described below.
The following filters are for Windows only.
NOTE: We suppose that mknmz works well on both of English version and Japanese version of Microsoft Office, but it is not confirmed yet. We would be greatful if you notice us when it works well. Thanks in advance.
namazu 2.0.x, a search program of Namazu. Usage: namazu [options] <query> [index]... -n, --max=NUM set number of documents shown to NUM. -w, --whence=NUM set first number of documents shown to NUM. -l, --list print results by listing format. -s, --short print results by short format. --result=EXT set NMZ.result.EXT for printing results. --late sort documents in late order. --early sort 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 number of hits. -h, --html print in HTML format. -r, --no-references do not display reference hit counts. -H, --page print further result links. (nearly meaningless) -F, --form force to print <form> ... </form> region. -R, --no-replace do not replace URI string. -U, --no-decode-uri do not decode 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 current configuration. -q, --quiet do not display extra messages except search results. -d, --debug be debug mode. -v, --version show the version of namazu and exit. --help show this help and exit Report bugs to <bug-namazu@namazu.org>.
You can specify one or more target indices in a command-line
argument [index dir]...
. If 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. -h option is required to display query results in HTML format.
If you want to display query results from 21st hits to 40th hits, type -n 20 -w 20 in a command line option. Note -w is not 21 in this example.
Various setting is possible in mknmzrc
or
.mknmzrc
. namazu reads configuration files
normally in the order of
$(sysconfdir)/$(PACKAGE)/namazurc
If more than one configuration files are found, they all 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
.
Default index is the index which is used by default. Default index follows the rules described bellow.
In CGI(namazu.cgi), the index selection is given as a relative path from the default index.
namazu.cgi
is CGI 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 .namazurc file
in the directory namazu.cgi is
stored, .namazurc file
will be treated as the CGI
configuration file. To display Japanese, you need the following
settings.
Lang ja
Template files define display styles of query results in HTML format. The details are described below.
These files are prepared for each 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 value="bar">bar <option value="baz">baz </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
, we will have directories
as follows.
/ + usr/ + local/ + var/ + namazu/ + index/ + foo/ + bar/ + baz/
For selecting multiple indices, NMZ.head need a checkbox.
<strong>Target</strong> <ul> <li><input type="checkbox" name="idxname" value="foo">foo <li><input type="checkbox" name="idxname" value="bar">bar <li><input type="checkbox" name="idxname" value="baz">baz </ul>
In the above example, you can select multiple indices from foo, bar,
and/or baz. The template file specified in Template directive in
namazurc
is used in searching. If no file is given in
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 value="+uri:/^http://foo.bar.jp/foo//">foo's pages <option value="+uri:/^http://foo.bar.jp/bar//">bar's pages <option value="+uri:/^http://foo.bar.jp/baz//">baz's pages <option value="+uri:/^http://foo.bar.jp/quux//">quux's pages </select> <input type="hidden" name="reference" value="off">
To select language of search results by 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 value="">English </select>
NOTE: Lang directive in .namazurc has precedence over CGI variable lang. So you must not set Lang directive in .namazurc if you want to use CGI variable lang.
bnamazu
is a search tool operates with Web
browsers. The query results are passed to a Web browser
(default:
lynx ) for users to browse. The command line options
are as follows.
% bnamazu [-n] [-b browser] [namazu's options] <query> [index]...
-b option specifies a Web browser. -n option is valid only when using netscape. -n option opens a new netscape window to display query results.
nmzgrep is an search tool operates with egrep
command. nmzgrep executes egrep for retrieved documents. By applying
egrep, you can find line numbers the keyword is found. The command
line options are as follows.
% nmzgrep [egrep's options] <pattern> [index]...
For example, to search ~/Namazu/foobar index for foo and apply egrep to searched documents, you can do as follows:
% nmzgrep foo ~/Namazu/foobar
When you repeat updates of indices caused by addition and/or
deletion of documents, garbage will be created 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 Date: header. The command line options
are as follows.
% mailutime <target>...
To change 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. Usage:
% rfnmz <index>
For example, to reconstruct NMZ.field.*.i files in ~/Namazu/foobar index, you can do as follows:
% rfnmz ~/Namazu/foobar
The query specifies only one term for retrieving all documents which contain the term. e.g.,
namazu
The query specifies two or more terms for retrieving all
documents which contain both terms. You can insert the
and
operator between the terms. e.g.,
Linux and Netscape
You can omit the and
operator. Terms which is
separated by one ore more spaces is assumed to be AND query.
The query specifies two or more terms for retrieving all
documents which contain either term. You can insert the
or
operator between the terms.
e.g.,
Linux or FreeBSD
The query specifies two or more terms for retrieving all
documents which contain a first term but doesn't contain the
following terms. You can insert the not
operator between the terms to do NOT query. e.g.,
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 which consists of two or more terms
by surrounding them with double quotes like
"..."
or with braces like {...}
.
In Namazu, precision of phrase searching is not 100 %,
so it causes wrong results occasionally. e.g.,
{GNU Emacs}
The are three types of substring matching searching.
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 offers generally Perl compatible flavor.
e.g.,
/pro(gram|blem)s?/
You can limit your search to specific fields such as
Subject:
, From:
,
Message-Id:
. It's especially convenient for
Mail/News documents. e.g.,
+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 handling isn't complete,
you can describe TCP and IP
instead of
TCP/IP
, but it may cause noisy results.
and
,
or
or not
simply as terms, you can
surround them respectively with double quotes like "..."
or braces like {...}
.