# CFCOLLECTION

The CFCOLLECTION tag allows you to create and administer Verity collections.

### Syntax

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

#### ACTION

Required. Specifies the action to perform:

- CREATE -- Creates a new collection using the specified path and optionally specified language.
- REPAIR -- Fixes data corruption in the collection.
- DELETE -- Destroys the collection.
- OPTIMIZE -- Purges and reorganizes data for efficiency.
- MAP -- Assigns an alias to an existing Verity collection.

#### COLLECTION

Required. Specifies a collection name or an alias if the ACTION is MAP.

#### PATH

Required for CREATE and MAP. Specifies a path to the Verity collection. The effect of the PATH attribute depends on the ACTION that you specify.

ACTION | What happens?
--- | ---
    CREATE
| CFCOLLECTION creates a directory for the use of Verity. The directory path is composed of the directory path specified in the PATH attribute with the name specified in the COLLECTION attribute appended to it. Thus, the full directory path is "path_name\collection_name\." For example, if the path name is "C:\Col\," and the collection name is "myCollection," the full directory path is "C:\Col\myCollection\."
    MAP
| The MAP action provides a name with which ColdFusion can reference an existing collection. This name is specified with the COLLECTION attribute. It is an alias for the collection, which can be used in CFINDEX, and to re-instate a collection after you have re-installed ColdFusion. The directory path specified with the PATH attribute is the full path name of the Verity directory. Therefore, to reference the directory created in the previous example, specify "C:\Col\myCollection\."

#### LANGUAGE

Optional for CREATE. To use the LANGUAGE attribute you must have the ColdFusion International Search Pack installed. Valid entries are:

- English (default)
- German
- Finnish
- French
- Danish
- Dutch
- Italian
- Norwegian
- Portuguese
- Spanish
- Swedish

### Usage

CFCOLLECTION works at the collection level only. To add content to a collection, use CFINDEX.

Note the following regarding mapped collections:

- Mapping allows you to assign an alias to a Verity collection created by a tool other than ColdFusion.
- The ACTION, COLLECTION, and PATH attributes are required.
- The path must point to a valid Verity collection; mapping does not validate the path.
- Deleting a mapped collection unregisters the alias; the base collection is not deleted.

### Example

    <!--- This example shows the basic functionality
    of the CFCOLLECTION tag (create, repair, optimize, delete) --->
    <HTML>
    <HEAD>
        <TITLE>CFCOLLECTION</TITLE>
    </HEAD>
    <BODY bgcolor=silver>
    <H3>CFCOLLECTION</h3>

    <!--- see if a collection name has been specificied ... --->
    <CFIF IsDefined("form.CollectionName") AND
    IsDefined("form.CollectionAction")>
        <CFIF form.CollectionName is not "">
            <CFOUTPUT>
            <CFSWITCH EXPRESSION=#FORM.CollectionAction#>
              <CFCASE VALUE="Create">
                <CFCOLLECTION ACTION="CREATE"
                 COLLECTION="#FORM.CollectionName#"
                 PATH="C:\CFUSION\Verity\Collections\">
                <H3>Collection created.</H3>
              </CFCASE>
              <CFCASE VALUE="Repair">
                <CFCOLLECTION ACTION="REPAIR"
                 COLLECTION="#FORM.CollectionName#">
                <H3>Collection repaired.</H3>
              </CFCASE>
              <CFCASE VALUE="Optimize">
                <CFCOLLECTION ACTION="OPTIMIZE"
                 COLLECTION="#FORM.CollectionName#">
                <H3>Collection optimized.</H3>
              </CFCASE>
              <CFCASE VALUE="Delete">
                <CFCOLLECTION ACTION="DELETE"
                 COLLECTION="#FORM.CollectionName#">
               <H3>Collection deleted.</H3>
              </CFCASE>
            </CFSWITCH>
    ...