User Guide

Table Of Contents
558 Chapter 24: Building a Search Interface
You successfully created a collection, named CodeColl, that currently has no data. For
information on indexing your collection using CFML, see “Indexing a collection using the
cfindex tag” on page 558.
Indexing a collection using the cfindex tag
You can index a collection in CFML using the
cfindex tag, which eliminates the need to use the
ColdFusion MX Administrator. The
cfindex tag populates the collection with metadata that is
then used to retrieve search results. You can use the
cfindex tag to index either physical files
(documents stored within your websites root folder), or the results of a database query.
Note: Prior to indexing a collection, you must create a Verity collection using either the ColdFusion
MX Administrator, or the
cfcollection tag. For more information, see “Creating a collection with the
ColdFusion MX Administrator” on page 553, or “Creating a collection with the cfcollection tag”
on page 555.
When using the cfindex tag, the following attributes correspond to the values that you would
enter using the ColdFusion MX Administrator to index a collection:
Attribute Description
collection
The name of the collection.
action
Specifies what the cfindex tag should do to the collection. The default action is
to update the collection, which generates a new index. Other
actions are to
delete, purge, or refresh the collection.
type
Specifies the type of files or other data to which the cfindex tag applies the
specified action. The value you assign to the
type attribute determines the value to
use with the
key attribute (see the following list). When you enter a value for the
type attribute, cfindex expects a corresponding value in the key attribute. For
example, if you specify
type=file, cfindex expects a directory path and filename
for the
key attribute.
The
type attribute has the following possible values:
file Specifies a directory path and filename for the file that you are indexing.
path Specifies a directory path that contains the files that you are indexing.
custom Specifies custom data, such as a record set returned from a query.
extensions
(Optional) The delimited list of file extensions that ColdFusion uses to index
files if
type="path".
key
The value that you specify for the key attribute depends on the value set for the
type attribute:
If
type="file", the key is the directory path and filename for the file you are
indexing.
If
type="path", the key is the directory path that contains the files you are
indexing.
If
type="custom", the key is a unique identifier specifying the location of the
documents you are indexing; for example, the URL of a specific web page or
website whose contents you want to index. If you are indexing data returned by
a query (from a database for example), the
key is the name of the record set
column that contains the primary key.