Space  Contents Previous Next


Querying

Query Forms
.Idq Files
.Htx Files


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.

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.

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 .idq files help convert queries. Working in tandem with .idq files, advanced .htx files format the query results. These advanced .htx files include extensions to handle the unique features of Index Server query results.

The following diagram shows the query process for Index Server:

The next diagram shows a close-up of the .idq and .htx files:


To TopQuery Forms

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”:

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.

With Microsoft Index Server, the administrator of a Web server can create customized forms 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. 

Creating a Query Form

The following example shows a basic query form:

To create this form, type the following HTML code in a file and save it in HTML format:

<FORM ACTION="/scripts/pdcdemo.idq?" METHOD="POST">
Enter your query:
<INPUT TYPE="TEXT" NAME="CiRestriction" SIZE="60" MAXLENGTH="100" VALUE=" ">
<INPUT TYPE="SUBMIT" VALUE="Excecute Query">
<INPUT TYPE="RESET" VALUE="Clear">
</FORM>

The two most important lines of HTML code are shown in bold. First, the line beginning with <FORM ACTION. . .>, tells where to find the .idq file 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.

Second, the line beginning with <INPUT TYPE=“TEXT”. . .> defines a variable called CiRestriction. This variable is preset to accept whatever text is typed into the query field (the Enter your query field, in the example). For example, if someone types “systems management” in this field, CiRestriction holds the text “systems management”.

When the Execute Query 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 Microsoft Index Server Query Language.


 To Top.Idq Files

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:

[Query]
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:\

The following list explains each line of the sample .idq file:

[Query]
Identifies the following information as a query restriction.
CiColumns=filename,size,rank,characterization, vpath,DocTitle,write
Indicates the kind of information to return in the result set.
CiFlags=DEEP
Tells the query to search all subfolders within the scope.
CiRestriction=%CiRestriction%
Indicates the query terms to search for.
CiMaxRecordsInResultSet=150
Sets the maximum number of results to be returned, 150 in this example.
CiMaxRecordsPerPage=10
Determines how many results are shown on each Web page returned. In this case, 10 results will be shown per Web page.
CiScope=/
Tells where to start the query. In this example, the query starts at the root of the storage space.
CiTemplate=/scripts/spdc1.htx
Indicates what file to use to format the results; in this case, Spdc1.htx.
CiSort=rank[d]
Tells how to sort the results. This example calls for results to be listed in descending [d] order.
CiCatalog=d: \
Points to the index to use (the one stored on D:\ in this example).

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 Internet Data Query Files.


To Top.Htx Files

 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 sample .idq file.

<%if CiMatchedRecordCount eq 0%>
<H4>No documents matched the query "<%CiRestrictionHTML%>".</H4>
<%else%>
<H4>Documents <%CiFirstRecordNumber%> to <%CiLastRecordNumber%> of
<%if CiMatchedRecordCount eq CiMaxRecordsInResultSet%>
the first
<%endif%>
<%CiMatchedRecordCount%> matching the query
<%CiRestrictionHTML%>".</H4>
<%endif%>

The text in the sample .htx file produces the following:

Documents 1 to 10 of the first 150 matching the query "systems management".

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 HTML Extension Files.


 Contents Previous To Top Next


© 1996 by Microsoft Corporation. All rights reserved.