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

<h3><a name="query-term" id="query-term">Single term query</a></h3>
<p>
This query specifies only one term for retrieving all of the
documents which contain that term, for example: 
</p>

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

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

<p>
This query specifies two or more terms for retrieving all of the
documents which contain both terms. 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 are
separated by one ore more spaces are assumed to be an AND query.
</p>

<h3><a name="query-or" id="query-or">OR query</a></h3>
<p>
This query specifies two or more terms for retrieving all
documents which contain any one term. 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" id="query-not">NOT query</a></h3>
<p>
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 <code class="operator">not</code>
operator between the terms, for example:
</p>

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


<h3><a name="query-grouping" id="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" id="query-phrase">Phrase searching</a></h3>
<p>
You can search for a phrase that consists of two or more terms
by surrounding them with double quotation marks or braces such as
<code class="operator">"..."</code> and <code class="operator">{...}</code>.
In Namazu, the precision of phrase searching is not 100 %,
so wrong results may occasionally occur.  Example:
</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" id="query-substring">Substring matching</a></h3>
<p>
The are three types of searching by substring matching.
</p>

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


<h3><a name="query-regex" id="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 generally offers a <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" id="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>. This feature is especially convenient for
Mail/News documents, for example:
</p>

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

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

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


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

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

<ul>
<li>In any queries, Namazu ignores case distinctions of
alphabet characters; i.e. Namazu does
case-insensitive pattern matching.
</li>

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

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

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


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

<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 with double quotes or braces like <code
class="operator">"..."</code> or <code
class="operator">{...}</code>. 

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

</ul>

