mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
164 lines
13 KiB
164 lines
13 KiB
<!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’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 “Publishing Information and Applications” 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 “systems
|
|
management”:</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’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 “systems management”), 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. </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><FORM ACTION="/scripts/pdcdemo.idq?" METHOD="POST"></tt></strong><tt>
|
|
Enter your query:
|
|
</tt><strong><tt><INPUT TYPE="TEXT" NAME="CiRestriction" SIZE="60" MAXLENGTH="100" VALUE=" "></tt></strong><tt>
|
|
<INPUT TYPE="SUBMIT" VALUE="Excecute Query">
|
|
<INPUT TYPE="RESET" VALUE="Clear">
|
|
</FORM></tt></pre>
|
|
</blockquote>
|
|
<p>The two most important lines of HTML code are shown in bold. First, the line beginning with <FORM ACTION. . .>, 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 <INPUT TYPE=“TEXT”. . .> 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 “systems management” in this field, <em>CiRestriction</em> holds the text “systems management”.</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 (“systems management” 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> <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> 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><%</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>%></code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><tt>
|
|
</tt><font size=3><code><H4>No documents matched the query "</code></font><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code><%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3>CiRestrictionHTML</font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%></code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><font size=3>".</H4></font><tt>
|
|
</tt><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code><%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3><code>else</code></font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%></code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><tt>
|
|
</tt><font size=3><code><H4>Documents </code></font><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code><%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3>CiFirstRecordNumber</font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%></code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><font size=3> to </font><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code><%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3>CiLastRecordNumber</font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%></code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><font size=3> of</font><tt>
|
|
</tt><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code><%</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>%></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><%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3><code>endif</code></font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%></code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><tt>
|
|
</tt><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code><%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3><code>CiMatchedRecordCount</code></font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%></code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><font size=3> matching the query</font><tt>
|
|
</tt><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code><%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3><code>CiRestrictionHTML</code></font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%></code></font><!--VERMEER BOT=HTMLMarkup EndSpan --></code><font size=3>".</H4></font><tt>
|
|
</tt><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code><%</code></font><!--VERMEER BOT=HTMLMarkup EndSpan --><font size=3><code>endif</code></font><code><!--VERMEER BOT=HTMLMarkup StartSpan --><font size=3><code>%></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 "systems management".</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>© 1996 by Microsoft Corporation. All rights reserved.</em>
|
|
<!--Footerend-->
|
|
</p>
|
|
</body>
|
|
|
|
</html>
|