So what, essentially, is the IDQ script to which the HTML form posts its data? The IDQ file is a script that defines every element of the query's execution, including the columns to be returned, the form field that contains the text to be retrieved, and the sort order of the result set.
Here's an excerpt from the wrox_idx.idq
file, the file referenced in the HTML file that we defined in the preceding section. Note that the CiColumns
entry is actually all on one line:
[Query]
CiColumns=filename,size,characterization,rank,path,hitcount,
vpath,DocTitle,write
CiCatalog=c:\IndexServer
CiScope=/
CiFlags=DEEP
CiRestriction=%CiRestriction%
CiMaxRecordsInResultSet=1000
CiMaxRecordsPerPage
CiTemplate=/wrox_idx.htx
CiSort=rank[d]
Hearkening back to the database analogy that I promised would dominate our examination of Index Server, you'll realize that the CiColumns
parameter in the IDQ file acts rather like the SELECT
clause in an SQL statement. It defines which properties and attributes of the indexed files are returned from the catalog. With the exception of characterization
, we've already looked at the selection above—when we talked about the query language of Index Server. The characterization
property is the abstract that Index Server automatically builds from the document, and is intended to indicate its broad contents.
Having specified which properties we want, we have to tell Index Server where to search for the documents. CiCatalog
is the location of the catalog storing the document details (it's possible to create different ones), and CiScope
is the virtual root from where we want to include documents. We can select any physical or mapped virtual folder here. In our case, we're starting at the main Internet Server root. To include all the subfolders below it, we've included CiFlags=DEEP
.
The CiRestriction
line in the script defines the query we want to use, and because it's sent from the browser as the value of the text box named CiRestriction
, we use this value in our script by enclosing it in percent signs, as %CiRestriction%
. We can either send the values of these variables from the controls on the form like this, or preset them directly as text values within the IDQ file.
The next two lines set the maximum number of documents to return, and the number we want to display in each page of the resulting HTML code that is sent back to the browser. Lastly, we specify the location of the HTX template file, and how the matching document details are to be sorted. In this case, we've chosen the usual: descending order by rank.
As a summary, the next table shows a list of common variables that are set in an IDQ script—either directly, or as a variable from a control in the <FORM>
section of a page:
Variable | Meaning |
CiCatalog | Location of the catalog, if not using the default. |
CiForceUseCi | TRUE to use the current index, even if out of date. |
CiScope | Start directory for the search. |
CiFlags | DEEP to include all subdirectories below CiScope , or SHALLOW for only the directory in CiScope . |
CiColumns | List of all the indexed values to be returned, i.e. the columns for the results set, separated by commas. |
CiRestriction | The query to be executed, i.e. what to search for. |
CiMaxRecordsInResultsSet | Maximum number of documents to be retrieved. |
CiMaxRecordsPerPage | Maximum number of documents to be returned on each page. |
CiSort | Order of the returned records, using the column names separated by commas. [d] indicates descending order. For example: |
State, Size [d], Name |
|
CiTemplate | Full virtual path to the HTX template file. |