CFCOLLECTION |
Description
Creates, registers, and administers Verity search engine collections.
A collection that is created with the cfcollection tag is internal. A collection created any other way is external.
A collection that is registered with ColdFusion using the cfcollection tag or registered with the K2 Server by editing the k2server.ini file is registered. Other collections are unregistered.
An internal collection can be created in these ways: With the cfcollection tag In the ColdFusion Administrator, which calls the cfcollection tag
An external collection can be created using a native Verity indexing tool, such as Vspider or MKVDK.
Category
Extensibility tags
Syntax
    <cfcollection
       action = "action"
       collection = "collection_name"
       path = "path_to_verity_collection"
       language = "language"
       name = "queryname" >
See also
cfexecute, cfindex, cfobject, cfreport, cfsearch, cfwddx
History
ColdFusion MX: Changed the requirements for the action attribute: it is now required. Added the action attribute list value. It is the default. Changed the requirements for the action attribute value map: it is not necessary to specify the action attribute value map. (ColdFusion detects collections and creates maps collections as required.) Changed acceptable collection naming: this tag accepts collection names that include spaces. Changed Verity operations behavior: ColdFusion supports Verity operations on Acrobat PDF files. Changed thrown exceptions: this tag can throw the SEARCHENGINE exception.
Usage With this tag you can create, register a Verity collection and administer a collection that was created by ColdFusion or by a Verity application. The following table shows the dependence relationships among this tag's attribute values:
Specifying this attribute is required, optional or unnecessary (blank): | For this action attribute value:
--- | ---
list | create | map | optimize | repair | delete
    collection
|  | Required | Required | Required | Required | Required
    path
|  | Required | Optional |  |  |
    language
|  | Optional | Optional |  |  |
    name
| Required |  |  |  |  |
If more than instance of the cfcollection tag might access or modify a collection simultaneously, use the cflock tag to protect the collection from attempts at simultaneous operations. To register a collection with K2Server, you update the k2server.ini file. Before you attempt to delete or purge a collection that is also opened by the K2Server, you must stop the K2Server. If you do not, some files may be open, and ColdFusion might not complete the action. The list action returns the following information in a result set that contains one row per collection:
Column | Contents
--- | ---
EXTERNAL | Yes: the collection is external No: the collection is not external Not Found: the collection is registered but is not available in the defined path
LANGUAGE | The locale setting of the collection. This information is not available for K2Server collections.
MAPPED | Yes: the collection is mapped No: the collection is not mapped This information is not available for K2Server collections.
NAME | For a ColdFusion registered collection: its name For a K2Server registered collection: its alias, defined in the k2server.ini file. (ColdFusion saves registered K2Server collection information; it is available regardless of whether the K2Server is running)
ONLINE | Yes: the collection can be searched No: the collection cannot be searched If EXTERNAL = "Not Found", this value is "No".
PATH | Absolute path to the collection. If the collection is mapped or is registered by a K2Server, the path includes the collection name.
REGISTERED | CF: collection is registered by ColdFusion K2: collection is registered by K2Server
The ColdFusion MX Administrator Verity > Collections page displays the information that is returned when you use the list attribute. If the K2 Server is not running when the list action is executed, the result set returned contains K2Server information that was current when the server became unavailable. To determine whether a collection exists, use code such as the following, to execute a query of queries:
    <cfcollection action="list" name="myCollections" >
    <cfquery name="qoq" dbtype="query">
    select * from myCollections
    where myCollections.name = 'myCollectionName'
    </cfquery>
    <cfdump var = #qoq#>
To get a result set with values for all the collections that are registered with the ColdFusion and K2 servers, use code such as the following:
    <cfcollection action="list" name="myCollections">
    <cfoutput query="myCollections">
       #name#<br>
    </cfoutput>
To add content to a collection, use cfindex. To search a collection, use cfsearch. With the European Verity Locales language pack installed, the language attribute of this tag supports the following options:
bokmal | french | norweg
danish | german | portug
dutch | italian | portuguese
english | nynorsk | spanish
finnish | norwegian | swedish
With the Asian Verity Locales language pack installed, the language attribute of this tag supports the following options:
arabic | hungarian | russian
czech | japanese | simplified_chinese
greek | korean | traditional_chinese
hebrew | polish | turkish
The default location of Verity collections is as follows: Windows: C:\CFusionMX\verity\collections Unix system: /opt/coldfusionmx/verity/collections
Example
    <!-------------------------------------------------------------------------
    Check for server platform and use it's default Verity Collection directory.
    You may need to change the path if you did not install ColdFusion MX in the
    default directory.
    ---------------------------------------------------------------------------
    <cfif Find("Windows", Server.OS.Name)>
       <cfset collPath = "C:\CFusionMX\Verity\Collections\">
    <cfelse>
       <cfset collpath = "/opt/coldfusionmx/verity/collections/">
    </cfif>

    <!--------------------------------------------------------------------
    Process form input and do the requested cfcollection operation.
    --------------------------------------------------------------------->

    <cfif IsDefined("form.CollectionName") AND IsDefined("form.CollectionAction")>
       <cfif form.CollectionName is not "">
          <cfswitch expression="#FORM.CollectionAction#">
            <cfcase value="Create">
              <cfcollection action="CREATE" collection="#FORM.CollectionName#"
    path="#collPath#">
              <h3>Collection created.<br>
             Use CFINDEX to populate it.</h3>
    <!--- <cfindex action="update" collection="#FORM.CollectionName#" type="path"
    key="c:\CFusionMX\wwwroot\tests" extensions="cfm">
     --->        </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>
       <cfelse>
       <h3>Please enter a name for your collection</h3>
       </cfif>
    </cfif>

    <!--------------------------------------------------------------------
    Form to specify the collection name and action
    --------------------------------------------------------------------->

    <form action="#CGI.SCRIPT_NAME" method="POST" >
    <select name="CollectionAction">
       <option value="Create">Create this collection
       <option value="Optimize">Optimize this collection
       <option value="Repair">Repair this collection
       <option value="Delete">Delete this collection
    </select>

    <p><strong>Collection on which to act</strong><br>
    Use the default value or enter your own Collection name<br>
    <input type="Text" name="CollectionName" value="snippets"></p>

    <input type="Submit" name="" value="alter or create my collection">
    </form>

ACTION |
| Required; see Usage section
Default value: "list" create: registers the collection with ColdFusion. - If the collection is present: creates a map to it - If the collection is not present: creates it repair: fixes data corruption in a collection. delete: unregisters a collection. - If the collection was registered with action = create: deletes its directories - If the collection was registered and mapped: does not delete collection directories map: creates a map to the collection. It is not necessary to specify this value. (ColdFusion maps collections automatically.) optimize: optimizes the structure and contents of the collection for searching; recovers space. list: returns a query result set, named from the name attribute value, of the attributes of the collections that are registered by ColdFusion and K2 Server.

COLLECTION |
| See Usage section
A collection name. The name can include spaces.

PATH |
| See Usage section
Absolute path to a Verity collection. To map an existing collection, specify a fully-qualified path to the collection (not including the collection name). For example, "C:\MyCollections\"

LANGUAGE |
| See Usage section
Default value: "English" Options are listed in Usage section. Requires the appropriate (European or Asian) Verity Locales language pack.

NAME |
| See Usage section
Name for the query results returned by the list action.