BackUp LevelNext

Populating a Collection from Document Files

This section covers the two methods for indexing files.

Indexing files with the ColdFusion Administrator

To index a collection from the Verity page:

  1. Select a collection name in the Verity Collections box.
  2. Click Index to open the index page. The selected collection name appears at the top of the page.
  3. Enter a single file type or multiple file types separated by commas.
  4. Type in the directory path for the collection or click Browse Server and navigate to the directory in which to begin the index.
  5. Check the Recursively index subdirectories box if you want to extend the indexing operation to all directories below the selected path.
  6. Optionally, you can enter a Return URL to prepend to all indexed files. This allows you to easily create a link to any of the files in the index. A typical entry might be something like http://localhost/wwwroot/.
  7. If the International Language Search Pack is installed, you can select one of the supported languages.
  8. Click Update to begin the indexing process. The time required to generate the index depends on the number and size of the selected files in the path.

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.

Indexing files with CFINDEX

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.

Type attribute options

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.


BackUp LevelNext

allaire

AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.