ColdFusion MX Professional Projects

The first step in developing a search interface for the ColdFusion application is to define a Verity collection. This is a collection of information that can be indexed and searched as a set. The Verity engine performs searches against these collections.

A Verity collection supports grouping of information for these three basic data types:

A collection can be built from individual documents or from an entire directory tree. You can use files from specific directories to create section-specific search capabilities. This is the fourth datatype supported by Verity.

There are two methods to create a Verity collection:

Creating a Collection Using ColdFusion Administrator

The Verity page of ColdFusion Administrator creates and manages collections. You can use ColdFusion Administrator to either map an existing Verity collection to the ColdFusion environment or create a new collection.

Mapping an existing Verity collection is useful because collections created using standard Verity tools can be used in ColdFusion templates. To create a new collection using ColdFusion Administrator, you need to specify the following:

To create a new collection, perform the following steps:

  1. Open the ColdFusion Administrator Verity Collections page, as shown in Figure 20.1. The documentation collection is listed by default if you used the option to install the ColdFusion documentation. The Verity engine searches for the online documents.

    Figure 20.1: The Verity Collections page.

  2. Enter a name for the collection.

  3. Enter a path for the directory location of the new collection.

  4. Select a language if you don't want to use the default, English.

  5. Select Create a New Collection.

  6. Click Submit Changes.

After you create the collection, its name and full path appear in the Verity Collections list.

To access and use an existing Verity collection in your ColdFusion templates, perform the following steps:

  1. Open ColdFusion Administrator.

  2. Enter the collection alias that you want to use locally in the ColdFusion application.

  3. Enter the path to the collection.

  4. Select a language, if the default isn't desired.

  5. Select Map an Existing Collection.

  6. Click Submit Changes.

After creating a Verity collection, you can perform various operations on it:

Creating a Collection Using the <CFCOLLECTION> Tag

The <CFCOLLECTION> tag is an alternative to accessing and using ColdFusion Administrator. You can use it to schedule the creation of a collection based on an event, or when you want end users to create collections without going through ColdFusion Administrator.

The following is the syntax for the <CFCOLLECTION> tag:

<CFCOLLECTION ACTION="action" COLLECTION="collection" PATH="implementation directory" LANGUAGE="language">

Here are the required attributes of <CFCOLLECTION>:

The following code snippet uses <CFCOLLECTION> to create a sample Verity collection:

<CFCOLLECTION ACTION="Create" COLLECTION="Sample" PATH="d:\cfusion\verity\collections">

You can also map an existing Verity collection, as in the following code snippet:

<CFCOLLECTION ACTION="Map" COLLECTION="ExistingCollection" PATH="c:\cfusion\verity\collections">

Категории