<h2><a name="query">Query</a></h2>

<h3><a name="query-term">Single term query</a></h3>
<p>
The query specifies only one term for retrieving all
documents which contain the term. e.g., 
</p>

<p class="example">
namazu
</p>

<h3><a name="query-and">AND query</a></h3> 

<p>
The query specifies two or more terms for retrieving all
documents which contain both terms. You can insert the
<code class="operator">and</code> operator between the terms. e.g., 
</p>

<p class="example">
Linux and Netscape
</p>

<p>
You can omit the <code class="operator">and</code> operator.  Terms which is
separated by one ore more spaces is assumed to be AND query.
</p>

<h3><a name="query-or">OR query</a></h3>
<p>
The query specifies two or more terms for retrieving all
documents which contain either term. You can insert the
<code class="operator">or</code> operator between the terms.
e.g.,
</p>

<p class="example">
Linux or FreeBSD
</p>

<h3><a name="query-not">NOT query</a></h3>
<p>
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 <code class="operator">not</code>
operator between the terms to do NOT query.  e.g.,
</p>

<p class="example">
Linux not UNIX
</p>


<h3><a name="query-grouping">Grouping</a></h3>
<p>
You can group queries by surrounding them by
parentheses. The parentheses should be separated by one or
more spaces. e.g., 
</p>

<p class="example">
( Linux or FreeBSD ) and Netscape not Windows
</p>

<h3><a name="query-phrase">Phrase searching</a></h3>
<p>
You can search for a phrase which consists of two or more terms
by surrounding them with double quotes like
<code class="operator">"..."</code> or with braces like <code class="operator">{...}</code>.
In Namazu, precision of phrase searching is not 100 %,
so it causes wrong results occasionally. e.g.,
</p>

<p class="example">
{GNU Emacs}
</p>

<!-- foo
<p>
You must choose the latter with Tkanamzu or namazu.el.
</p>
-->

<h3><a name="query-substring">Substring matching</a></h3>
<p>
The are three types of substring matching searching.
</p>

<dl> 
<dt>Prefix matching
<dd><code class="example">inter*</code> (terms which begin with <code>inter</code>)
<dt>Inside matching
<dd><code class="example">*text*</code> (terms which contain <code>text</code>) 
<dt>Suffix matching
<dd><code class="example">*net</code> (terms which terminated
with <code>net</code>)
</dl>


<h3><a name="query-regex">Regular expressions</a></h3>

<p>
You can use regular expressions for pattern matching. The
regular expressions must be surrounded by slashes like <code
class="operator">/.../</code>. Namazu uses <a
href="http://www.ruby-lang.org/">Ruby</a>'s regular
regular expressions engine. It offers generally <a
href="http://www.perl.com/">Perl</a> compatible flavor.
e.g.,
</p>

<p class="example">
/pro(gram|blem)s?/
</p>


<h3><a name="query-field">Field-specified searching</a></h3>
<p>
You can limit your search to specific fields such as
<code>Subject:</code>, <code>From:</code>,
<code>Message-Id:</code>. It's especially convenient for
Mail/News documents. e.g.,
</p>

<ul>
<li><code class="example">+subject:Linux</code><br>
(Retrieving all documents which contain <code>Linux</code>
in a <code>Subject:</code> field)

<li><code class="example">+subject:"GNU Emacs"</code><br>
(Retrieving all documents which contain <code>GNU Emacs</code>
in a <code>Subject:</code> field)

<li><code class="example">+from:foo@bar.jp</code><br>
(Retrieving all documents which contain <code>foo@bar.jp</code>
in a <code>From:</code> field)


<li><code class="example">+message-id:&lt;199801240555.OAA18737@foo.bar.jp&gt;</code><br>
(Retrieving a certain document which contains specified
<code>Message-Id:</code>)
</ul>

<h3><a name="query-notes">Notes</a></h3>

<ul>
<li>In any queries, Namazu ignores case distinctions of
alphabet characters. In other words, Namazu does
case-insensitive pattern matching in any time.


<li>Japanese phrases are forced to be segmented into
morphemes automatically and are handled them as <a
href="#query-phrase">phrase searching</a>. This processing
causes invalid segmentation occasionally.


<li>Alphabet, numbers or a part of symbols (duplicated in
ASCII) characters which defined in JIS X 0208 (Japanese
Industrial Standards) are handled as ASCII characters.

<li>Namazu can handle a term which contains symbols like
<code>TCP/IP</code>.  Since this handling isn't complete,
you can describe <code>TCP and IP</code> instead of
<code>TCP/IP</code>, but it may cause noisy results.


<li>Substring matching and field-specified searching takes
more time than other methods.

<li>If you want to use <code class="operator">and</code>,
<code class="operator">or</code> or <code
class="operator">not</code> simply as terms, you can
surround them respectively with double quotes like <code
class="operator">"..."</code> or braces like <code
class="operator">{...}</code>. 

<!-- foo
You must choose the latter with Tkanamzu or namazu.el.
-->

</ul>

