|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Creating a Collection
|
|
|
|
ColdFusion provides two interfaces for creating a Verity collection. You can make selections on the ColdFusion Administrator Verity page or code the CFCOLLECTION tag.
|
|
|
|
Running the ColdFusion Administrator |
|
|
|
Open the ColdFusion Administrator Verity page. If you checked the option to install the ColdFusion Documentation, the documentation collection is listed by default. The Verity engine is used to search our online documents.
|
|
|
|
To create a new collection:
|
|
|
- In the Add a Collection section, type in a name for the collection.
- Type in a path for the location of the new collection. By default, new collections are added to
\Cfusion\Verity\Collections\ .
- If you have an International Language Search Pack installed, you can select a language for the collection from the drop-down list.
- Click Create a new collection. When the collection is created, the name and full path of the new collection appear in the Verity Collections list at the top of the page.
You can easily enable access to a collection on the network by creating a local reference (an alias) for that collection. It only needs to be a valid Verity collection; it doesn't matter whether it was created within ColdFusion or another tool.
|
|
|
|
To add an existing collection:
|
|
|
- In the Add a Collection section, type in the collection alias.
- Enter the full path to the collection.
- Select Language if needed.
- Click Map an existing collection.
- Click Apply.
If the collection is subsequently moved, the alias path must be updated. The Delete command, when used on a mapped collection, only deletes the alias.
|
|
|
|
Coding the CFCOLLECTION tag |
|
|
|
Creating and maintaining collections from a CFML application eliminates the need to access the ColdFusion Administrator. This can be an advantage when you need to schedule these tasks or to allow users to perform them without exposing the Administrator.
With the introduction of CFCOLLECTION, Verity tasks can now be grouped in a more logical way. CFCOLLECTION can be used for collection creation and maintenance and CFINDEX can be used to populate and update collections.
The valid values for the ACTION attribute are:
- Create -- Creates a new collection using the specified path and optionally specified language.
- Repair -- Attempts to fix corrupted data in the specified collection.
- Delete -- Deletes the specified collection.
- Optimize -- Reorganizes the collection data for greater efficiency, similar to a DBMS optimize operation.
- Map -- Assigns an alias to an existing collection.
The CREATE and MAP actions require a collection name and path. The MAP action additionally requires an alias name. The LANGUAGE attribute is required for data in languages other than English. Only the ACTION and COLLECTION attributes are required for maintenance tasks.
<CFCOLLECTION ACTION="action"
COLLECTION="collection"
PATH="implementation directory"
LANGUAGE="language">
|
|
|
|
Example: Collection action page
|
|
|
This example processes input from a form. Notice the use the new CFSWITCH tag to control page flow.
<HTML>
<HEAD>
<TITLE>CFCOLLECTION</TITLE>
</HEAD>
<BODY>
<H1>CFCOLLECTION</H1>
<CFOUTPUT>
<CFSWITCH EXPRESSION=#FORM.CollectionAction#>
<CFCASE VALUE="Create">
<CFCOLLECTION ACTION="Create"
COLLECTION="#FORM.CollectionName#"
PATH="C:\CFUSION\Verity\Collections\">
</CFCASE>
<CFCASE VALUE="Repair">
<CFCOLLECTION ACTION="REPAIR"
COLLECTION="#FORM.CollectionName#">
<P>Collection repaired.
</CFCASE>
<CFCASE VALUE="Optimize">
<CFCOLLECTION ACTION="OPTIMIZE"
COLLECTION="#FORM.CollectionName#">
<P>Collection optimized.
</CFCASE>
<CFCASE VALUE="Delete">
<CFCOLLECTION ACTION="DELETE"
COLLECTION="#FORM.CollectionName#">
<P>Collection deleted.
</CFCASE>
</CFSWITCH>
</CFOUTPUT>
</BODY>
</HTML>
The CFCOLLECTION tag operates at the collection level. To add content to a collection, use the CFINDEX tag.
|
|
|
  
|
|
|
AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.
|