A PHP class to encapsulate the Microsoft Indexing Service (cisvc). Tested under version 3.0 of Indexing Service on Windows 2000 and IIS5.

NOTE: I am not a professional programmer or web page author. This code should be used for educational purposes and should be highly suspect in a production envrironment.

Contents - the class definition
search.php - an example page using the class
search1.php - an example page that is not using the class.

I began by translating the ASP example from into PHP and then built the class to support a similar page but makig it easier. This is shown in search1.php.

During the attempt to translate the page from ASP to PHP, I discovered that I could not save the record set across PHP sessions as was done in the Microsoft example. This probably makes this class useless in a production environment as the ASP version would be superior in performance and the class can only work on Microsoft OS. Instead of preserving the record set across sessions, I instead created a new record set on each run and then use a page counter to jump within the larger record set.

The example page attempts to be very close to the ASP original. The PHP test page search.php is pretty close to the original example but does show some additional features like how to select a different page size.


cisvc ($strSearchString, $iCurrPage = 0, $iPageSize=10, $strColumns="doctitle, vpath, path, filename, characterization, size, write")
$strSearchString is the string to be searched for in the index.
$iCurrPage allows you to specify a starting point in the record set other than the beginning. This offset is 0 indexed but most display is in human form so I add one before displaying.
$iPageSize is an optional parameter to specify how many pages should be stored in the record set. The default is 10. If specified, it must be specified the same on every call or the pages get confused.
$strColumns is the fields to be collected in the record set. The first 4 are pretty much mandatory to get a useful search. The last three (characterization, size, write) are pretty optional. Additional fields are documented within MSDN. The available fields vary based on what software is installed. vpath is only available in the Web Index. Additional fields are available if Site Server ( a Microsoft content management product) are installed.

Most interesting method
Dumps the output in a nice form. Uses style that should be defined in the calling script to format output.
Weakness 1 -- I tried but failed to get around using the <dd> entry. When I used style to get an indentation, the right side wrapped badly in IE.
Weakness 2 -- The path to the server in the HTML <a> is hardcoded to be the current server. It is possible to use Content Index to index a foreign server but I infer from the documentation that this requires Site Server and it would provide the additional fields to find out what the real server is.