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.
|