![]() ![]() ![]() |
This section covers the two methods for indexing files.
http://localhost/wwwroot/
.
As you can see, this interface allows you to easily build a very specific index based on the file extension and path information you enter. In most cases, your server file structures need not be changed to accommodate the generation of indices.
In your ColdFusion application, you can populate and search multiple collections, each of which can be designed to focus on a specific group of documents or queries, according to subject, document type, location, or any other logical grouping. Searches can be performed against multiple collections, giving you lots of flexibility in designing your search interface.
To programmatically index files, set the index parameters in CFSET tags, then specify those values in CFINDEX attributes. To illustrate these steps, we'll use a section of an indexing template generated by the Verity Wizard in ColdFusion Studio. To run the wizard, click File > New and select the Verity Wizard from the CFML tab of the New Document dialog.
This collection is a set of draft documents and supporting files used during the review process of the ColdFusion 4.0 documentation.
<CFSET IndexCollection = "Review Docs"> <CFSET IndexDirectory = "C:\Projects\CF40\Doc Source\"> <CFSET IndexRecurse = "YES"> <CFSET IndexExtensions = ".htm, .doc, .xls"> <CFSET IndexLanguage = "English">
The collection parameters listed here mirror those on the Administrator Verity Index page. The extensions list for this index includes HTML files, Microsoft Word documents, and Excel worksheets. To revert to the default extensions, simply enter double quotes with no space between. Other wildcards, such as *.* have no effect.
The indexing attributes and values are then entered.
<CFINDEX COLLECTION="#IndexCollection#" ACTION="REFRESH" TYPE="PATH" KEY="#IndexDirectory#\" EXTENSIONS="#IndexExtensions#" RECURSE"#IndexRecurse#" LANGUAGE="#IndexLanguage#">
Below this you can enter other CFML code as needed and HTML page elements for the search interface.
Generally, a server path is entered as the value for the TYPE attribute, but you can use the TYPE="FILE" option under special circumstances, such as indexing a database table containing a list of file names. For more information on this topic, see the Allaire Knowledge Base article, "Using Indirection with CFINDEX TYPE=FILE" (ID# 1083) on our Web site.
![]() ![]() ![]() |
AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.