Populates a Verity search engine collection with an index of documents on a file system or of ColdFusion query result sets.
A collection must exist before it can be populated.
A collection can be indexed in the following ways:
cfindex tagcfindex tag For more information, see Building a Search Interface in Developing ColdFusion MX Applications.
<cfindex
collection = "collection_name"
action = "action"
type = "type"
title = "title"
key = "ID"
body = "body"
custom1 = "custom_value"
custom2 = "custom_value"
URLpath = "URL"
extensions = "file_extensions"
query = "query_name"
recurse = "Yes" or "No"
language = "language">
cfcollection, cfexecute, cfobject, cfreport, cfsearch, cfwddx
ColdFusion MX:
action attribute value optimize is obsolete. It does not work, and might cause an error, in ColdFusion MX.external attribute behavior: it is not necessary to specify the external attribute. (ColdFusion automatically detects whether a collection is internal or external.)cfindex tag can index the query results from a cfsearch tag.| Attribute | Req/Opt | Default | Description |
|---|---|---|---|
collection |
Required |
|
|
action |
Depends on |
|
|
type |
Optional |
|
|
title |
Optional |
|
Permits searching collections by title or displaying a separate title from the key |
key |
Depends on |
(empty string) |
This attribute is required for the actions listed, unless you intend for its value to be an empty string. |
body |
Required if |
|
You can specify columns in a delimited list. For example: |
custom1 |
Optional |
|
Custom field in which you can store data during an indexing operation. Specify a query column name for |
custom2 |
Optional |
|
Usage is the same as for |
URLpath |
Optional |
|
If |
extensions |
Optional |
HTM, HTML, CFM, CFML, DBM, DBML |
Delimited list of file extensions that ColdFusion uses to index files, if
For example: the following code returns files with a listed extension or no extension: |
query |
Required if |
|
Query against which collection is generated |
recurse |
Optional |
No |
|
language |
Optional |
English |
For options, see cfcollection. Requires the appropriate (European or Asian) Verity Locales language pack. |
This tag populates Verity search engine collections with metadata from the following sources:
The following table shows the dependent relationships among this tag's attribute values:
| Specifying this attribute is required, optional or unnecessary (blank): | For this action attribute value: | ||
|---|---|---|---|
purge
|
delete
|
update or refresh
|
|
collection |
Required |
Required |
Required |
type |
|
Optional |
If |
title |
|
|
If Otherwise: unnecessary. |
key |
|
Required |
If Otherwise: unnecessary. |
body |
|
|
If Otherwise: unnecessary. |
custom1 |
|
|
If Otherwise: unnecessary. |
custom2 |
|
|
If Otherwise: unnecessary. |
URLPath |
|
|
If Otherwise: unnecessary. |
extensions |
|
|
If Otherwise: unnecessary. |
query |
|
If If |
If If |
recurse |
|
|
If Otherwise: unnecessary. |
language |
|
If If |
If |
For all action values of this tag except update, use the cflock tag to protect the collection during tag execution.
For information on the file types you can use with the Verity search engine, see Article 22492, ColdFusion Server (versions 4.5 and higher): Supported File Types for Verity, on the Macromedia ColdFusion Support Center, at www.macromedia.com/support/coldfusion/.
<!--- 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>