windows-nt/Source/XPSP1/NT/inetsrv/query/web/html/help/queryhlp.htm
2020-09-26 16:20:57 +08:00

165 lines
13 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Microsoft Index Server Guide: Querying Basics</title>
<meta name="FORMATTER" content="Microsoft FrontPage 1.1">
<meta name="GENERATOR" content="Microsoft FrontPage 1.1">
</head>
<body bgcolor="#FFFFFF">
<!--Headerbegin-->
<p align=center><a name="TOP"><img src="onepix.gif" alt="Space" align=middle width=1 height=1></a> <a href="default.htm#Top"><img src="toc.gif" alt=" Contents" align=middle border=0 width=89 height=31></a> <a href="install.htm"><img src="previous.gif" alt="Previous" align=middle border=0 width=32 height=31></a> <a href="qrylang.htm"><img src="next.gif" alt="Next" align=middle border=0 width=32 height=31></a> </p>
<hr>
<!--Headerend-->
<p><a name="Querying"><font size=6><strong>Querying</strong></font></a></p>
<p align=left><!--Chaptoc--></p>
<blockquote>
<p><a href="queryhlp.htm#QueryForms">Query Forms</a> <br>
<a href="queryhlp.htm#IDQ">.Idq Files</a> <br>
<a href="queryhlp.htm#HTX">.Htx Files</a> <br>
</p>
</blockquote>
<hr>
<!--ChaptocEnd--><p>Querying through Microsoft Index Server is a complex process that interacts with Internet Information Server (IIS) or Peer
Web Services (PWS). Because of this close interaction with IIS or PWS, the querying process in Index Server borrows the
same model that IIS and PWS use for querying an Open Database Connectivity (ODBC) data source. </p>
<p>The Internet Database Connector (IDC), a feature of IIS and PWS, converts a query from a HyperText Markup Language
(HTML) form into a search that works with ODBC. This feature lets you query any database that complies with ODBC, such
as Microsoft SQL Server. When a database receives a query, it returns the results, which the IDC converts into an HTML
page and displays the page on the user&#146;s screen. The results generally contain hyperlinks to other HTML documents and also
include properties (such as file size, summary information, and so on) of the these HTML documents. For a detailed example
of how an IDC query works with an ODBC-compatible database, see the &#147;Publishing Information and Applications&#148; topic in
the IIS or PWS documentation.</p>
<p>In the IIS-PWS model, .idc files help the IDC convert queries sent from the HTML forms. Working in tandem with .idc files,
.htx files specify how the results are formatted and displayed to the user. Similarly, with Index Server .<a href="#IDQ">idq files</a> help convert
queries. Working in tandem with .idq files, advanced <a href="#HTX">.htx files</a> format the query results. These advanced .htx files include
extensions to handle the unique features of Index Server query results.</p>
<p>The following diagram shows the query process for Index Server:</p>
<p><img src="Active6.gif" align=bottom width=330 height=324></p>
<p>The next diagram shows a close-up of the .idq and .htx files:</p>
<p><img src="active6a.gif" align=bottom width=422 height=249></p>
<hr>
<h1><a href="#TOP"><img src="up.gif" alt="To Top" align=middle border=0 width=14 height=11></a><a name="QueryForms">Query Forms</a></h1>
<p>With a query form, you can conveniently search for a word or phrase anywhere in a set of documents. Just fill out the form,
and execute the query. In the following sample form, a user wants to search for all documents containing the phrase &#147;systems
management&#148;:</p>
<p><img src="Active2.gif" align=bottom width=561 height=319></p>
<p>After filling out the form, the user clicks the Execute Query button to start the query. The results are then displayed on the
user&#146;s screen.</p>
<p>With Microsoft Index Server, the administrator of a Web server can <a href="#BuildiForm">create customized forms</a> to help employees and other
clients find specific information from a set of documents. For example, a form can be tailored to search for a word or phrase
(such as &#147;systems management&#148;), or for other properties such as the author or subject. You create a query form in standard
HTML format, just as you would create any Web page. If you know how to write pages in HTML format, you can quickly
put together a simple query form.&#160;</p>
<h2><a name="BuildiForm">Creating a Query Form</a></h2>
<p>The following example shows a basic query form:</p>
<p><img src="Active7.gif" align=bottom width=561 height=167></p>
<p>To create this form, type the following HTML code in a file and save it in HTML format:</p>
<blockquote>
<pre><strong><tt>&lt;FORM ACTION=&quot;/scripts/pdcdemo.idq?&quot; METHOD=&quot;POST&quot;&gt;</tt></strong><tt>
Enter your query:
</tt><strong><tt>&lt;INPUT TYPE=&quot;TEXT&quot; NAME=&quot;CiRestriction&quot; SIZE=&quot;60&quot; MAXLENGTH=&quot;100&quot; VALUE=&quot; &quot;&gt;</tt></strong><tt>
&lt;INPUT TYPE=&quot;SUBMIT&quot; VALUE=&quot;Excecute Query&quot;&gt;
&lt;INPUT TYPE=&quot;RESET&quot; VALUE=&quot;Clear&quot;&gt;
&lt;/FORM&gt;</tt></pre>
</blockquote>
<p>The two most important lines of HTML code are shown in bold. First, the line beginning with &lt;FORM ACTION. . .&gt;, tells
where to find the .<a href="#IDQ">idq file</a> that goes with this form. An .idq file helps process an Index Server query form, so every Index
Server query form must specify a corresponding .idq file.</p>
<p>Second, the line beginning with &lt;INPUT TYPE=&#147;TEXT&#148;. . .&gt; defines a variable called <em>CiRestriction</em>. This variable is preset
to accept whatever text is typed into the query field (the <strong>Enter your query</strong> field, in the example). For example, if someone
types &#147;systems management&#148; in this field, <em>CiRestriction</em> holds the text &#147;systems management&#148;.</p>
<p>When the <strong>Execute Query</strong> button is clicked, the data in the text field is sent to IIS or PWS and processed. The IIS or PWS
server locates the specified .idq file and passes the query data (&#147;systems management&#148; in the example) and the .idq file to the
Index Server program. For detailed information about query language, which lets you contruct complex queries, see <a href="qrylang.htm">Microsoft
Index Server Query Language</a>.</p>
<hr>
<h1>&#160;<a href="#TOP"><img src="up.gif" alt="To Top" align=middle border=0 width=14 height=11></a><a name="IDQ">.Idq Files</a></h1>
<p>The internet data query (.idq) file defines query parameters such as the scope of your search, any restrictions, and query
results sets. The following example shows a basic .idq file:</p>
<blockquote>
<pre><a name="[Query]">[Query]</a>
CiColumns=filename,size,rank,characterization, vpath,DocTitle,write
CiFlags=DEEP
CiRestriction=%CiRestriction%
CiMaxRecordsInResultSet=150
CiMaxRecordsPerPage=10
CiScope=/
CiTemplate=/scripts/spdc1.htx
CiSort=rank[d]
CiCatalog=d:\</pre>
</blockquote>
<p>The following list explains each line of the sample .idq file:</p>
<blockquote>
<dl>
<dt>[Query]</dt>
<dd>Identifies the following information as a query restriction.<br>
</dd>
<dt>CiColumns=filename,size,rank,characterization, vpath,DocTitle,write</dt>
<dd>Indicates the kind of information to return in the result set.<br>
</dd>
<dt>CiFlags=DEEP</dt>
<dd>Tells the query to search all subfolders within the scope.<br>
</dd>
<dt>CiRestriction=%CiRestriction%</dt>
<dd>Indicates the query terms to search for.<br>
</dd>
<dt>CiMaxRecordsInResultSet=150</dt>
<dd>Sets the maximum number of results to be returned, 150 in this example.<br>
</dd>
<dt>CiMaxRecordsPerPage=10</dt>
<dd>Determines how many results are shown on each Web page returned. In this case, 10 results will be
shown per Web page.<br>
</dd>
<dt>CiScope=/</dt>
<dd>Tells where to start the query. In this example, the query starts at the root of the storage space.<br>
</dd>
<dt>CiTemplate=/scripts/spdc1.htx</dt>
<dd>Indicates what file to use to format the results; in this case, Spdc1.htx.<br>
</dd>
<dt>CiSort=rank[d]</dt>
<dd>Tells how to sort the results. This example calls for results to be listed in descending [d] order.<br>
</dd>
<dt>CiCatalog=d: \</dt>
<dd>Points to the index to use (the one stored on D:\ in this example).</dd>
</dl>
</blockquote>
<p>When the results are returned in raw format, Index Server formats the results according to the .htx file specified in the
CiTemplate parameter. For details about the .idc file and how to format it, see <a href="idqhelp.htm">Internet Data Query Files</a>.</p>
<hr>
<h1><a href="#TOP"><img src="up.gif" alt="To Top" align=middle border=0 width=14 height=11></a><a name="HTX">.Htx Files</a></h1>
<p>&#160;The HTML extension (.htx) file is an HTML file that contains variables that refer to data in a query results set. For example,
the following code defines a page header that displays the query restriction and the documents displayed on the page the user
sees. This file is written to work in tandem with the variables indicated in this <a href="#[Query]">sample .idq file</a>.</p>
<blockquote>
<pre><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>&lt;%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3><code>if CiMatchedRecordCount eq 0</code></font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%&gt;</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><tt>
</tt><font size=3><code>&lt;H4&gt;No documents matched the query &quot;</code></font><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>&lt;%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3>CiRestrictionHTML</font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%&gt;</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><font size=3>&quot;.&lt;/H4&gt;</font><tt>
</tt><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>&lt;%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3><code>else</code></font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%&gt;</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><tt>
</tt><font size=3><code>&lt;H4&gt;Documents </code></font><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>&lt;%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3>CiFirstRecordNumber</font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%&gt;</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><font size=3> to </font><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>&lt;%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3>CiLastRecordNumber</font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%&gt;</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><font size=3> of</font><tt>
</tt><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>&lt;%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3><code>if CiMatchedRecordCount eq CiMaxRecordsInResultSet</code></font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%&gt;</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><tt>
</tt><font size=3><code>the first</code></font><tt>
</tt><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>&lt;%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3><code>endif</code></font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%&gt;</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><tt>
</tt><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>&lt;%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3><code>CiMatchedRecordCount</code></font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%&gt;</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><font size=3> matching the query</font><tt>
</tt><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>&lt;%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3><code>CiRestrictionHTML</code></font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%&gt;</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><font size=3>&quot;.&lt;/H4&gt;</font><tt>
</tt><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>&lt;%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3><code>endif</code></font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%&gt;</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code></pre>
</blockquote>
<p>The text in the sample .htx file produces the following:</p>
<blockquote>
<pre><font size=3><code>Documents 1 to 10 of the first 150 matching the query &quot;systems management&quot;.</code></font></pre>
</blockquote>
<p>Through this example you can see that the .htx file is a template that formats how results are returned to the user. The file is
written in HTML format with some extensions supplied by IIS and Index Server. These extensions include variable names and
other codes for processing results. For details about the .htx file and how to format it, see <a href="htxhelp.htm">HTML Extension Files</a>.</p>
<!--Footerbegin-->
<hr>
<p align=center><a href="default.htm#Top"><img src="toc.gif" alt=" Contents" align=middle border=0 width=89 height=31></a> <a href="install.htm"><img src="previous.gif" alt="Previous" align=middle border=0 width=32 height=31></a> <a href="#TOP"><img src="up_end.gif" alt="To Top" align=middle border=0 width=32 height=31></a> <a href="qrylang.htm"><img src="next.gif" alt="Next" align=middle border=0 width=32 height=31></a></p>
<hr>
<p align=center><em>&#169; 1996 by Microsoft Corporation. All rights reserved.</em>
<!--Footerend-->
</p>
</body>
</html>