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:

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

New in ColdFusion MX:

Attributes

Attribute Req/Opt Default Description
action
Required; see Usage section
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: un-registers 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
Required
 
  • A collection name. The name can include spaces.
path
Optional
 
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
Optional
English
Options are listed in Usage section. Requires the appropriate (European or Asian) Verity Locales language pack.
name
Required if action = "list"
 
Name for the query results returned by the list action.

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
 
Optional
Optional
 
 
 
language
 
Optional
Optional
 
 
 
name
Required
 
 
 
 
 

For all action values of this tag, use the cflock tag to protect the collection during tag execution.

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 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

You can also display this information in the Administrator, under Verity > Collections.

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:

<cflock name="verity" timeout="60">
  <cfcollection action="list" name="myCollections" > 
</cflock>
<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:

<cflock name="verity" timeout="60">
  <cfcollection action="list" name="myCollections">
</cflock>
<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:

 

Example

<!--- for ACTION=UPDATE ----------------------------------------------->
<!--- for ACTION=UPDATE, #1 (TYPE=FILE) (key is a filename) ---->
<cfindex 
    collection="snippets" 
    action="update" 
    type="file"
    key="c:\inetpub\wwwroot\cfdocs\snippets\abs.cfm" 
    urlpath="http://localhost/cfdocs/snippets" 
    custom1="custom1" 
    custom2="custom2" > 

<!--- for ACTION=UPDATE, #2 (TYPE=FILE) (key is a query result set column) ---->
<cfquery     name="bookquery" 
    datasource="book">
    select *from book where bookid='file' 
</cfquery> 
<cfoutput 
    query="bookquery"> 
        --#url#,#description#-- <br>
</cfoutput> 
<cfindex
    collection="snippets"
    action="update"
    type="file"
    query="bookquery"
    key="description"
    urlpath="url">

<!--- for ACTION=UPDATE, #3 (TYPE=PATH) (extensions .htm, .html,.cfm,.cfml) --->
<cfindex     collection="snippets" 
    action="update"
    type="path"
    key="c:\inetpub\wwwroot\cfdocs\snippets" 
    urlpath="http://localhost/cfdocs/snippets" 
    custom1="custom1" 
    custom2="custom2" 
    recurse="no" 
    extensions=".htm, .html, .cfm, .cfml" >

<!--- for ACTION=UPDATE, #4 (TYPE=PATH) 
    (extensions are     files with no extension) ---->
<cfindex 
    collection="snippets"
    action="update"
    type="path"
    key="c:\inetpub\wwwroot\cfdocs\snippets" 
    urlpath="http://localhost/cfdocs/snippets" 
    custom1="custom1"
    custom2="custom2"
    recurse="no" 
    extensions="*." >

<!--- for ACTION=UPDATE, #5 (TYPE=PATH) 
    (extensions are files with any extension) ---->
<cfindex 
    collection="snippets"
    action="update"
    type="path"
    key="c:\inetpub\wwwroot\cfdocs\snippets"
    urlpath="http://localhost/cfdocs/snippets"
    custom1="custom1"
    custom2="custom2"
    recurse="no" 
    extensions=".*">

<!--- for ACTION=UPDATE, #6 (TYPE=PATH) (where the key 
    is a query result set column) ---->
<cfquery     name="bookquery"
    datasource="book"> 
    select * from book where bookid='path1' or bookid='path2' 
</cfquery> 
<cfoutput
    query="bookquery">
        --#url#,#description#-- <br> 
</cfoutput> 
<cfindex
    collection="snippets" 
    action="update"
    type="path"
    query="bookquery"
    key="description"
    urlpath="url" >

<!--- for ACTION=UPDATE, #7 (TYPE=CUSTOM) ---->
<cfquery     name="book" 
    datasource="book">
    select * from book 
</cfquery>
<cfindex 
    collection="custom_book" 
    action="update" 
    type="custom" 
    body="description" 
    key="bookid" 
    query="book"> 

<!--- for ACTION=REFRESH----------------------------------------------->
<!--- ACTION=REFRESH, #1 (TYPE=FILE) ---->
<cflock     name="verity" 
    timeout="60">
<cfindex 
    collection="snippets" 
    action="Refresh"
    type="file"
    key="c:\inetpub\wwwroot\cfdocs\snippets\abs.cfm" 
    urlpath="http://localhost/"
    custom1="custom1"
    custom2="custom2" >
</cflock>

<!--- ACTION=REFRESH, #2 (TYPE=PATH) ---->
<cflock     name="verity" 
    timeout="60">
<cfindex 
    collection="snippets"
    action="refresh"
    type="path"
    key="c:\inetpub\wwwroot\cfdocs\snippets"
    urlpath="http://localhost/cfdocs/snippets/"
    custom1="custom1"
    custom2="custom2"
    recurse="yes" 
    extensions=".htm,.html,.cfm,.cfml" >
</cflock>

<!--- ACTION=REFRESH, #3 (TYPE=CUSTOM) ---->
<cfquery     name="book" 
    datasource="book">
    select * from book 
</cfquery>
<cfindex 
    collection="custom_book" 
    action="refresh" 
    type="custom" 
    body="description" 
    key="bookid" 
    query="book">

<!--- for ACTION=DELETE----------------------------------------------->

<!--- ACTION=DELETE, #1 (TYPE=FILE) ---->
<cflock     name="verity" 
    timeout="60">
<cfindex 
    collection="snippets" 
    action="delete" 
    key="c:\inetpub\wwwroot\cfdocs\snippets\abs.cfm" >
</cflock>

<!--- ACTION=DELETE, #2 (TYPE=FILE) (the key is a query result set column) ---->
<cflock     name="verity" 
    timeout="60">
<cfquery     name="book" 
    datasource="book">
    select * from book where bookid='file'
</cfquery> 
<cfoutput 
    query="book">
        --#description#-- <br>
</cfoutput>    
<cfindex 
    collection="snippets" 
    action="delete"
    type="file"
    query="book" 
    key="description" >
</cflock>

<!--- ACTION=DELETE, #3 (TYPE=PATH) ---->
<cflock     name="verity" 
    timeout="60">
<cfindex 
    collection="snippets"
    action="delete"
    type="path"
    key="c:\inetpub\wwwroot\cfdocs\snippets" 
    extensions=".cfm"
    recurse="no">
</cflock>

<!--- ACTION=DELETE, #4 (TYPE=PATH) (key is a query result set column) ---->
<cflock     name="verity" 
    timeout="60">
<cfquery 
    name="bookquery"
    datasource="book">
        select * from book where bookid='path1'
        </cfquery> 
<cfoutput 
    query="bookquery"> 
        --#url#,#description#-- <br> 
</cfoutput> 
<cfindex 
    collection="snippets" 
    action="delete"
    type="path"
    query="bookquery" 
    key="description" >
</cflock>

<!--- ACTION=DELETE, #5 (TYPE=CUSTOM) ---->
<cflock name="verity" 
    timeout="60">
<cfquery     name="book" 
    datasource="book">
    select * from book where bookid='bookid1'
</cfquery>
<cfindex 
    collection="custom_book" 
    action="delete"
    type="custom"
    query="book"
    key="bookid" >
</cflock>

<!--- for ACTION=PURGE----------------------------------------------->
<cflock name="verity" 
    timeout="60"> 
<cfindex 
    action="purge"
    collection="snippets">
</cflock>

Comments